-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Labels
api: spannerIssues related to the googleapis/python-spanner-sqlalchemy API.Issues related to the googleapis/python-spanner-sqlalchemy API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Environment details
- Programming language: Python
- OS: Linux
- Language runtime version: 3.7.12
- Package version:
SQLAlchemy==1.4.26
sqlalchemy-spanner==1.2.0
mysql-connector-python==8.0.26
Steps to reproduce
- Setup an engine for spanner, then setup an engine for mysql using mysqlconnector.
- Run a query on spanner engine, works fine
- Run a query on mysql engine, the query is executed, but throws an error
spanner_engine = sqlalchemy.create_engine("spanner+spanner:///projects/PROJECT/instances/INSTANCE/databases/DB")
mysql_engine = sqlalchemy.create_engine('mysql+mysqlconnector://USER:PASS@HOST/')
print(spanner_engine.execute('SELECT 1').scalar())
print(mysql_engine.execute('SELECT 1').scalar())
Output:
1
Exception during reset or similar
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 739, in _finalize_fairy
fairy._reset(pool)
File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 982, in _reset
pool.dispatch.reset(self, self._connection_record)
File "/usr/local/lib/python3.7/site-packages/sqlalchemy/event/attr.py", line 256, in __call__
fn(*args, **kw)
File "/usr/local/lib/python3.7/site-packages/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py", line 51, in reset_connection
if dbapi_conn.connection.inside_transaction:
AttributeError: 'CMySQLConnection' object has no attribute 'inside_transaction'
1
It seems to be similar to the issue that is fixed in this PR: #188
The issue was mentioned here #192 (comment), but when using one engine. While using separate engine works, it still throws that error.
I'm currently using this fork to avoid throwing this error, following the comment from @IlyaFaer here #192 (comment)
but I'm not sure if just avoiding that operation is the correct solution.
Thanks!
meetchandan and amha19
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the googleapis/python-spanner-sqlalchemy API.Issues related to the googleapis/python-spanner-sqlalchemy API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.