wthorp commented on issue #16055:
URL: https://github.com/apache/superset/issues/16055#issuecomment-2675895238

   If anyone finds themselves here in the future, this shouldn't be too big of 
a lift.  There's a SQLAlchemy project for Spanner, so its not hard to get 
things _almost_ working.
   
   Add these package lines to docker/requirements-local.txt
   ```
   sqlalchemy-spanner
   google-cloud-spanner
   ```
   
   Configure your GCP service account in docker/.env
   ```
   GOOGLE_APPLICATION_CREDENTIALS=/app/gcp_creds.json
   ```
   
   Include your GCP credentials in the Dockerfile
   ```
   COPY --chown=superset:superset gcp_creds.json /app/gcp_creds.json
   ```
   
   You should be able to add a database using the SQLAlchemy URI features with 
a format like
   ```
   
spanner+spanner:///projects/{project_id}/instances/{instance_id}/databases/{database_id}
   ```
   
   This should correctly populate the Database and its Schemas, but not the 
Tables.  SQL Lab works as well.
   The Table listing issue is likely due to Spanner disallowing 
`information_schema` queries inside transactions.
   It's trivial to make SQLAlchemy happy in test code, but I haven't had luck 
driving the Superset configs yet.
   ```
       with engine.connect() as connection:
           connection.execution_options(isolation_level="AUTOCOMMIT")  # This 
is the fix
           result = connection.execute(text("SELECT table_name FROM 
information_schema.tables WHERE table_catalog = ''"))
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to