use of com.google.api.services.datastream.v1alpha1.model.MysqlColumn in project DataflowTemplates by GoogleCloudPlatform.
the class DataStreamClient method getMysqlObjectSchema.
private Map<String, StandardSQLTypeName> getMysqlObjectSchema(String streamName, String schemaName, String tableName, SourceConfig sourceConnProfile) throws IOException {
Map<String, StandardSQLTypeName> objectSchema = new HashMap<String, StandardSQLTypeName>();
MysqlTable table = discoverMysqlTableSchema(streamName, schemaName, tableName, sourceConnProfile);
for (MysqlColumn column : table.getMysqlColumns()) {
StandardSQLTypeName bqType = convertMysqlToBigQueryColumnType(column);
objectSchema.put(column.getColumnName(), bqType);
}
return objectSchema;
}
use of com.google.api.services.datastream.v1alpha1.model.MysqlColumn in project DataflowTemplates by GoogleCloudPlatform.
the class DataStreamClient method getMysqlPrimaryKeys.
public List<String> getMysqlPrimaryKeys(String streamName, String schemaName, String tableName, SourceConfig sourceConnProfile) throws IOException {
List<String> primaryKeys = new ArrayList<String>();
MysqlTable table = discoverMysqlTableSchema(streamName, schemaName, tableName, sourceConnProfile);
for (MysqlColumn column : table.getMysqlColumns()) {
Boolean isPrimaryKey = column.getPrimaryKey();
if (BooleanUtils.isTrue(isPrimaryKey)) {
primaryKeys.add(column.getColumnName());
}
}
return primaryKeys;
}
Aggregations