-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingengineengines, connections, transactions, isolation levels, execution optionsengines, connections, transactions, isolation levels, execution optionsnear-term releaseaddition to the milestone which indicates this should be in a near-term releaseaddition to the milestone which indicates this should be in a near-term releaseregressionsomething worked and was broken by a changesomething worked and was broken by a change
Milestone
Description
Describe the bug
We are upgrading a code base from SQLALchemy v1.4x to v2.x.
On v1.4, URL.normalized_query would return a dictionary as stated by the official documentation.
On v2.x, URL.normalized_query throws {AttributeError}AttributeError("'URL' object has no attribute '__dict__'"). The error is raised in the memoized helper function.
Optional link from https://docs.sqlalchemy.org which documents the behavior that is expected
https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.engine.URL.normalized_query
SQLAlchemy Version in Use
2.0.9
DBAPI (i.e. the database driver)
asyncpg
Database Vendor and Major Version
Postgres 14
Python Version
3.10
Operating system
Linux
To Reproduce
uri = make_url("postgresql://test:something@127.0.0.1:5432/tests?schema=public")
data = uri.normalized_queryError
Traceback (most recent call last):
File "/Users/me/Documents/Developments/TMP_WORKSPACES/myproject/action.git/action/database/sqlalchemy/sqlalchemy.py", line 375, in __migrate
await self._migrate(instance=instance, options=options)
File "/Users/me/Documents/Developments/TMP_WORKSPACES/myproject/action.git/action/database/sqlalchemy/sqlalchemypostgresql.py", line 217, in _migrate
db_schema = (uri.normalized_query or {}).get("schema", None)
File "/Users/me/.pyenv/versions/action_py310_0/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 1138, in __get__
obj.__dict__[self.__name__] = result = self.fget(obj)
AttributeError: 'URL' object has no attribute '__dict__'
Additional context
None
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingengineengines, connections, transactions, isolation levels, execution optionsengines, connections, transactions, isolation levels, execution optionsnear-term releaseaddition to the milestone which indicates this should be in a near-term releaseaddition to the milestone which indicates this should be in a near-term releaseregressionsomething worked and was broken by a changesomething worked and was broken by a change