Search in sources :

Example 1 with OracleColumn

use of com.google.api.services.datastream.v1alpha1.model.OracleColumn in project DataflowTemplates by GoogleCloudPlatform.

the class DataStreamClient method getOraclePrimaryKeys.

public List<String> getOraclePrimaryKeys(String streamName, String schemaName, String tableName, SourceConfig sourceConnProfile) throws IOException {
    List<String> primaryKeys = new ArrayList<String>();
    OracleTable table = discoverOracleTableSchema(streamName, schemaName, tableName, sourceConnProfile);
    for (OracleColumn column : table.getOracleColumns()) {
        Boolean isPrimaryKey = column.getPrimaryKey();
        if (BooleanUtils.isTrue(isPrimaryKey)) {
            primaryKeys.add(column.getColumnName());
        }
    }
    return primaryKeys;
}
Also used : OracleTable(com.google.api.services.datastream.v1alpha1.model.OracleTable) ArrayList(java.util.ArrayList) OracleColumn(com.google.api.services.datastream.v1alpha1.model.OracleColumn)

Example 2 with OracleColumn

use of com.google.api.services.datastream.v1alpha1.model.OracleColumn in project DataflowTemplates by GoogleCloudPlatform.

the class DataStreamClient method getOracleObjectSchema.

private Map<String, StandardSQLTypeName> getOracleObjectSchema(String streamName, String schemaName, String tableName, SourceConfig sourceConnProfile) throws IOException {
    Map<String, StandardSQLTypeName> objectSchema = new HashMap<String, StandardSQLTypeName>();
    OracleTable table = discoverOracleTableSchema(streamName, schemaName, tableName, sourceConnProfile);
    for (OracleColumn column : table.getOracleColumns()) {
        StandardSQLTypeName bqType = convertOracleToBigQueryColumnType(column);
        objectSchema.put(column.getColumnName(), bqType);
    }
    return objectSchema;
}
Also used : OracleTable(com.google.api.services.datastream.v1alpha1.model.OracleTable) HashMap(java.util.HashMap) OracleColumn(com.google.api.services.datastream.v1alpha1.model.OracleColumn) StandardSQLTypeName(com.google.cloud.bigquery.StandardSQLTypeName)

Aggregations

OracleColumn (com.google.api.services.datastream.v1alpha1.model.OracleColumn)2 OracleTable (com.google.api.services.datastream.v1alpha1.model.OracleTable)2 StandardSQLTypeName (com.google.cloud.bigquery.StandardSQLTypeName)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1