1

I am using jooq and trying to generate code for sql building.

I succesfuly connected to db and configured code generator, but when run it fails while querying for tables information. This looks like possible bug but I am not sure if I'm doing everything correctly.

This is code snippet I'm using:

String CONNECTION_URL = "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;ProjectId=:project_id:;OAuthType=3;";
        Configuration configuration = new Configuration()
                .withJdbc( new Jdbc()
                        .withDriver("com.simba.googlebigquery.jdbc42.Driver")
                        .withUrl(CONNECTION_URL.replace(":project_id:", Config.GCP_PROJECT)))
                .withGenerator(new Generator()
                        .withDatabase(new Database()
                                .withName("org.jooq.meta.bigquery.BigQueryDatabase")
                                .withIncludes(".*")
                                .withExcludes("")
                                .withInputSchema("exchange"))
                        .withTarget(new Target()
                                .withPackageName("org.jooq.codegen.maven.example")
                                .withDirectory("target/generated-sources/jooq")));
        GenerationTool.generate(configuration);

and this fails with:

 org.jooq.codegen.GeneratorException: Error generating code for catalog 
.
.
.
    org.jooq.exception.DataAccessException: SQL [SELECT
  t.TABLE_SCHEMA,
  t.TABLE_NAME,
  t.TABLE_TYPE,
  TRIM(o.OPTION_VALUE, '"') AS COMMENT
FROM INFORMATION_SCHEMA.TABLES t
LEFT JOIN INFORMATION_SCHEMA.TABLE_OPTIONS o
ON t.TABLE_CATALOG = o.TABLE_CATALOG
AND t.TABLE_SCHEMA = o.TABLE_SCHEMA
AND t.TABLE_NAME = o.TABLE_NAME
AND o.OPTION_NAME = 'description'
WHERE t.TABLE_SCHEMA = 'exchange'
ORDER BY 1, 2
]; [Simba][BigQueryJDBCDriver](100032) Error executing query job. Message: 400 Bad Request
POST https://bigquery.googleapis.com/bigquery/v2/projects/project/jobs
{
  "code": 400,
  "errors": [
    {
      "domain": "global",
      "message": "Table \"INFORMATION_SCHEMA.TABLES\" must be qualified with a dataset (e.g. dataset.table).",
      "reason": "invalid"
    }
  ],
  "message": "Table \"INFORMATION_SCHEMA.TABLES\" must be qualified with a dataset (e.g. dataset.table).",
  "status": "INVALID_ARGUMENT"

I tried updating drivers BigQueryJDBC to 1.3.3 I am using jooq 3.18.6

This query seems invalid, is this maybe a bug ?

  • This issue has also been cross posted here, and will be investigated to see if it's a bug: https://github.com/jOOQ/jOOQ/issues/15472 – Lukas Eder Aug 17 '23 at 15:42

0 Answers0