Search in sources :

Example 1 with AdsHelper

use of com.alibaba.datax.plugin.writer.adswriter.load.AdsHelper in project DataX by alibaba.

the class AdsInsertUtil method getAdsTableColumnNames.

/*
     * 返回列顺序为ads建表列顺序
     * */
public static List<String> getAdsTableColumnNames(Configuration conf) {
    List<String> tableColumns = new ArrayList<String>();
    AdsHelper adsHelper = AdsUtil.createAdsHelper(conf);
    TableInfo tableInfo = null;
    String adsTable = conf.getString(Key.ADS_TABLE);
    try {
        tableInfo = adsHelper.getTableInfo(adsTable);
    } catch (AdsException e) {
        throw DataXException.asDataXException(AdsWriterErrorCode.GET_ADS_TABLE_MEATA_FAILED, e);
    }
    List<ColumnInfo> columnInfos = tableInfo.getColumns();
    for (ColumnInfo columnInfo : columnInfos) {
        tableColumns.add(columnInfo.getName());
    }
    LOG.info("table:[{}] all columns:[\n{}\n].", adsTable, StringUtils.join(tableColumns, ","));
    return tableColumns;
}
Also used : ArrayList(java.util.ArrayList) ColumnInfo(com.alibaba.datax.plugin.writer.adswriter.ads.ColumnInfo) TableInfo(com.alibaba.datax.plugin.writer.adswriter.ads.TableInfo) AdsHelper(com.alibaba.datax.plugin.writer.adswriter.load.AdsHelper) AdsException(com.alibaba.datax.plugin.writer.adswriter.AdsException)

Example 2 with AdsHelper

use of com.alibaba.datax.plugin.writer.adswriter.load.AdsHelper in project DataX by alibaba.

the class AdsInsertUtil method getAdsTableInfo.

public static TableInfo getAdsTableInfo(Configuration conf) {
    AdsHelper adsHelper = AdsUtil.createAdsHelper(conf);
    TableInfo tableInfo = null;
    try {
        tableInfo = adsHelper.getTableInfo(conf.getString(Key.ADS_TABLE));
    } catch (AdsException e) {
        throw DataXException.asDataXException(AdsWriterErrorCode.GET_ADS_TABLE_MEATA_FAILED, e);
    }
    return tableInfo;
}
Also used : TableInfo(com.alibaba.datax.plugin.writer.adswriter.ads.TableInfo) AdsHelper(com.alibaba.datax.plugin.writer.adswriter.load.AdsHelper) AdsException(com.alibaba.datax.plugin.writer.adswriter.AdsException)

Example 3 with AdsHelper

use of com.alibaba.datax.plugin.writer.adswriter.load.AdsHelper in project DataX by alibaba.

the class AdsInsertUtil method getAdsTableColumns.

/*
     * 返回列顺序为ads建表列顺序
     * */
public static List<ColumnInfo> getAdsTableColumns(Configuration conf) {
    AdsHelper adsHelper = AdsUtil.createAdsHelper(conf);
    TableInfo tableInfo = null;
    String adsTable = conf.getString(Key.ADS_TABLE);
    try {
        tableInfo = adsHelper.getTableInfo(adsTable);
    } catch (AdsException e) {
        throw DataXException.asDataXException(AdsWriterErrorCode.GET_ADS_TABLE_MEATA_FAILED, e);
    }
    List<ColumnInfo> columnInfos = tableInfo.getColumns();
    return columnInfos;
}
Also used : ColumnInfo(com.alibaba.datax.plugin.writer.adswriter.ads.ColumnInfo) TableInfo(com.alibaba.datax.plugin.writer.adswriter.ads.TableInfo) AdsHelper(com.alibaba.datax.plugin.writer.adswriter.load.AdsHelper) AdsException(com.alibaba.datax.plugin.writer.adswriter.AdsException)

Aggregations

AdsException (com.alibaba.datax.plugin.writer.adswriter.AdsException)3 TableInfo (com.alibaba.datax.plugin.writer.adswriter.ads.TableInfo)3 AdsHelper (com.alibaba.datax.plugin.writer.adswriter.load.AdsHelper)3 ColumnInfo (com.alibaba.datax.plugin.writer.adswriter.ads.ColumnInfo)2 ArrayList (java.util.ArrayList)1