You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 8, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 8, 2026. It is now read-only.
Currently CloudSpanner supports GoogleSql and PostgreSql dialects. So in the code there are ifs which change the bahaviour of the library depending on the dialect. For example in Table API there is the following code:
The problem is that by default database_dialect is set to 0 == DATABASE_DIALECT_UNSPECIFIED. In this case else part will be executed. By chance it will work for a database that uses GoogleSQL but it will not work for PostgreSql database. In the case of an error a user will see the following misleading message:
Invalid parameter name: table_id. Expected one of 'p1', 'p2', ..., 'p65535'
To reproduce use this code:
my_table=database.table("my_table")
ifmy_table.exists():
print("Table with ID 'my_table' exists.")
else:
print("Table with ID 'my_table' does not exist.")
Where database is a newly created database using PostgreSql dialect. The fix is to call database.reload() which will populate self._database.database_dialect correctly. However, the error message is very misleading and finding the root couse is very difficult. The situation can be improved if we use else if instead of else and if we raise an error for unknown dialect:
Activity