0

When creating BigQuery tables using the Java com.google.cloud:google-cloud-bigquery library, I don't see the BIGNUMERIC column data-type in the StandardSQLTypeName enumerations. I see NUMERIC but not BIGNUMERIC. How would I create a table with a BIGNUMERIC column programmatically? Thanks!

  Field f1 = Field.newBuilder("first_name", StandardSQLTypeName.STRING).build();
  Field f2 = Field.newBuilder("score", StandardSQLTypeName.NUMERIC).build();
  Schema schema = Schema.of(Arrays.asList(f1,f2));

  TableId tableId = TableId.of("my_data_set", "tbl_people"));
  TableDefinition tableDefinition = StandardTableDefinition.of(schema);
  TableInfo tableInfo = TableInfo.newBuilder(tableId, tableDefinition).build();

  bigQuery.create(tableInfo);
Vladimir
  • 1,120
  • 2
  • 11
  • 18
  • Hi @Vladimir, were you able to update to the latest version of **com.google.cloud:google-cloud-bigquery** library and use the `BIGNUMERIC` enum? If yes, consider accepting the answer so the community knows if you've been helped. See [What should I do when someone answers my question?](https://stackoverflow.com/help/someone-answers) – Catherine O Feb 11 '22 at 07:14
  • Yes thank you for the lead! It looked like there was a very old BOM import for all GCP libraries including BigQuery that was being prioritized over my current imports. Once that was resolved, I saw the BigNumber enumeration. Thank you for your help. – Vladimir Feb 12 '22 at 17:15

1 Answers1

1

If you're using versions 1.124.7 and below, the enum for StandardSQLTypeName.BIGNUMERIC is not yet present. I suggest you use the latest version (1.125.0 and up).

You can refer to this doc for a detailed guide on how to create and use BigQuery table.

Catherine O
  • 943
  • 1
  • 9