GCP CLOUD SQL denies permission for pre aggregation

212 Views Asked by At

I am trying to use pre aggregations over CLOUD SQL on Google Cloud Platform but the database is denying access and giving error Statement violates GTID consistency. Any help is appreciated.

1

There are 1 best solutions below

1
On

Cube.js done pre-aggregation by CREATE TABLE ... SELECT, but you are using MySQL on top of Google SQL with --enforce-gtid-consistency (has limitations).

Since only transactionally safe statements can be logged, there is a limitation to use CREATE TABLE ... SELECT (and some another SQL), because this statement is actually logged as two separate events.

There are two ways how to solve this issue:

1. Use pre-aggregations to an external database. (recommended way).

https://cube.dev/docs/pre-aggregations/#read-only-data-source-pre-aggregations

2. Use not documented flag loadPreAggregationWithoutMetaLock

Attention: This flag is an experimental and can be removed or changed in the feature..

Take a look at the source code

You can pass it directly in the driver constructor. This will produce two SQL statements to pass the limitation:

  • CREATE TABLE
  • INSERT INTO

Thanks