Package com.alibaba.otter.node.etl.common.db.dialect

Examples of com.alibaba.otter.node.etl.common.db.dialect.DbDialect.findTable()


        dbMediaSource.setType(DataMediaType.ORACLE);

        final DbDialect dbDialect = dbDialectFactory.getDbDialect(2L, dbMediaSource);
        // want.object(dbDialect).clazIs(MysqlDialect.class);

        Table table = dbDialect.findTable("otter2", "test_time");
        System.out.println(table);

        final SqlTemplate sqlTemplate = dbDialect.getSqlTemplate();
        final JdbcTemplate jdbcTemplate = dbDialect.getJdbcTemplate();
        final TransactionTemplate transactionTemplate = dbDialect.getTransactionTemplate();
View Full Code Here


        dbMediaSource.setType(DataMediaType.MYSQL);

        final DbDialect dbDialect = dbDialectFactory.getDbDialect(2L, dbMediaSource);
        want.object(dbDialect).clazIs(MysqlDialect.class);

        Table table = dbDialect.findTable("test", "ljh_demo");
        System.out.println(table);

        final SqlTemplate sqlTemplate = dbDialect.getSqlTemplate();
        final JdbcTemplate jdbcTemplate = dbDialect.getJdbcTemplate();
        final TransactionTemplate transactionTemplate = dbDialect.getTransactionTemplate();
View Full Code Here

    @Test
    public void testMysqlTable() {
        DbDataMedia mysqlMedia = getMysqlMedia();
        DbDialect dbDialect = dbDialectFactory.getDbDialect(1L, mysqlMedia.getSource());
        Table table = dbDialect.findTable(mysqlMedia.getNamespace(), mysqlMedia.getName());
        want.object(table).notNull();

        System.out.println("tableName = " + table.getName());
        Column[] columns = table.getColumns();
        for (Column column : columns) {
View Full Code Here

    @Test
    public void testOracleTable() {
        DbDataMedia oracleMedia = getOracleMedia();
        DbDialect dbDialect = dbDialectFactory.getDbDialect(1L, oracleMedia.getSource());
        Table table = dbDialect.findTable(oracleMedia.getNamespace(), oracleMedia.getName());
        want.object(table).notNull();

        System.out.println("tableName = " + table.getName());
        Column[] columns = table.getColumns();
        for (Column column : columns) {
View Full Code Here

        dbMediaSource.setType(DataMediaType.MYSQL);

        final DbDialect dbDialect = dbDialectFactory.getDbDialect(2L, dbMediaSource);
        want.object(dbDialect).clazIs(MysqlDialect.class);

        Table table = dbDialect.findTable(SCHEMA_NAME, TABLE_NAME);
        System.out.println(table);

        final SqlTemplate sqlTemplate = dbDialect.getSqlTemplate();
        final JdbcTemplate jdbcTemplate = dbDialect.getJdbcTemplate();
        final TransactionTemplate transactionTemplate = dbDialect.getTransactionTemplate();
View Full Code Here

        if (useTableTransform || enableCompatibleMissColumn) {// 控制一下是否需要反查table meta信息,如果同构数据库,完全没必要反查
            // 获取目标库的表信息
            DbDialect dbDialect = dbDialectFactory.getDbDialect(dataMediaPair.getPipelineId(),
                                                                (DbMediaSource) dataMedia.getSource());

            Table table = dbDialect.findTable(result.getSchemaName(), result.getTableName());
            tableHolder = new TableInfoHolder(table, useTableTransform, enableCompatibleMissColumn);
        }

        // 处理column转化
        List<EventColumn> otherColumns = translateColumns(result, data.getColumns(), context.getDataMediaPair(),
View Full Code Here

                DbDialect dbDialect = dbDialectFactory.getDbDialect(dataMediaPair.getPipelineId(), dbMediaSource);
                String schemaName = tableHolder.getTable().getSchema();
                if (StringUtils.isEmpty(schemaName)) {
                    schemaName = tableHolder.getTable().getCatalog();
                }
                Table table = dbDialect.findTable(schemaName, tableHolder.getTable().getName(), false); // 强制反查一次,并放入cache

                tableHolder.setTable(table);
                matchDbColumn = getMatchColumn(tableHolder.getTable().getColumns(), tcolumn.getColumnName());
                if (matchDbColumn == null) {
                    if (canColumnsNotExist) {
View Full Code Here

                        // 重新构建新的业务主键字段
                        EventColumn pkDataColumn = getMatchColumn(eventData.getColumns(), PK_DATA);
                        String pkData = pkDataColumn.getColumnValue();
                        String[] pks = StringUtils.split(pkData, PK_SPLIT);

                        Table table = dbDialect.findTable(eventData.getSchemaName(), eventData.getTableName());
                        List<EventColumn> newColumns = new ArrayList<EventColumn>();
                        Column[] primaryKeyColumns = table.getPrimaryKeyColumns();
                        if (primaryKeyColumns.length > pks.length) {
                            throw new ExtractException("data pk column size not match , data:" + eventData.toString());
                        }
View Full Code Here

        eventData.setTableId(dataMedia.getId());
        if (useTableTransform || dataMedia.getSource().getType().isOracle()) {// oracle需要反查一次meta
            // 如果设置了需要进行table meta转化,则反查一下table信息
            // 比如oracle erosa解析时可能使用了非物理主键,需要直接使用,信任erosa的信息
            DbDialect dbDialect = dbDialectFactory.getDbDialect(pipeline.getId(), (DbMediaSource) dataMedia.getSource());
            table = dbDialect.findTable(eventData.getSchemaName(), eventData.getTableName());// 查询一下meta信息
            if (table == null) {
                logger.warn("find table[{}.{}] is null , may be drop table.",
                    eventData.getSchemaName(),
                    eventData.getTableName());
            }
View Full Code Here

    private boolean checkNeedDbForRowMode(Pipeline pipeline, EventData eventData) {
        // 获取数据表信息
        DataMedia dataMedia = ConfigHelper.findDataMedia(pipeline, eventData.getTableId());
        DbDialect dbDialect = dbDialectFactory.getDbDialect(pipeline.getId(), (DbMediaSource) dataMedia.getSource());
        Table table = dbDialect.findTable(eventData.getSchemaName(), eventData.getTableName());
        if (table.getColumnCount() == eventData.getColumns().size() + eventData.getKeys().size()) {
            return false;
        } else {
            return true;
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.