Search code examples
postgresqlapache-flink

Flink JDBC UUID – source connector


In Flink 1.15, I want to read a column that is typed with the Postgres UUID type (the id column).

However, this does not work; crashes with The PostgreSQL dialect doesn't support type: RAW('java.lang.String', '...') NOT NULL. How can I interpret all id results as a plain string?

  • DataTypes.STRING() doesn't work
  • .columnByExpression("id", "CAST(id AS VARCHAR(32))") doesn't work
  • .columnByExpression("id", "\"id\"::varchar") doesn't work

screenshot of code


Solution

  •             TableDescriptor.forConnector("jdbc")
                        .schema(
                                Schema.newBuilder()
                                        .column("app_id", DataTypes.STRING().notNull())
                                        .column("moniker", DataTypes.STRING().notNull())
                                        .columnByExpression("a_proctime", "PROCTIME()")
                                        .primaryKey("app_id")
                                        .build())