SQLA queries fail due to `AbstractConcreteBase and has a mapping pending until all subclasses are defined`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the failure with the shown imports, tunnel_pipelines profile, session, and Gaia_DR3 query. Start by examining sdssdb.sqlalchemy.sdss5db.catalogdb.Gaia_DR3 and the surrounding model definitions, then investigate when mapper configuration occurs; verify the fix by confirming the query succeeds without the UnmappedClassError.
Written by the indexing model from the issue text.
Description
When I try a query using the SQLAlchemy model they all fail with error AbstractConcreteBase and has a mapping pending until all subclasses are defined.
For example
>>> from sdssdb.sqlalchemy.sdss5db import database, catalogdb
>>> database.set_profile('tunnel_pipelines')
True
>>> session = database.Session()
>>> session.query(catalogdb.Gaia_DR3).first()
[ERROR]: Traceback (most recent call last):
File "/Users/gallegoj/.pyenv/versions/3.10.14/envs/valis/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3577, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-5-3e43bb8cd684>", line 1, in <module>
x = session.query(catalogdb.Gaia_DR3).first()
File "/Users/gallegoj/.pyenv/versions/3.10.14/envs/valis/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2166, in query
return self._query_cls(entities, self, **kwargs)
File "/Users/gallegoj/.pyenv/versions/3.10.14/envs/valis/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 180, in __init__
self._set_entities(entities)
File "/Users/gallegoj/.pyenv/versions/3.10.14/envs/valis/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 187, in _set_entities
self._raw_columns = [
File "/Users/gallegoj/.pyenv/versions/3.10.14/envs/valis/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 188, in <listcomp>
coercions.expect(
File "/Users/gallegoj/.pyenv/versions/3.10.14/envs/valis/lib/python3.10/site-packages/sqlalchemy/sql/coercions.py", line 183, in expect
insp = inspection.inspect(element, raiseerr=False)
File "/Users/gallegoj/.pyenv/versions/3.10.14/envs/valis/lib/python3.10/site-packages/sqlalchemy/inspection.py", line 64, in inspect
ret = reg(subject)
File "/Users/gallegoj/.pyenv/versions/3.10.14/envs/valis/lib/python3.10/site-packages/sqlalchemy/orm/decl_api.py", line 1056, in _inspect_decl_meta
_DeferredMapperConfig.raise_unmapped_for_cls(cls)
File "/Users/gallegoj/.pyenv/versions/3.10.14/envs/valis/lib/python3.10/site-packages/sqlalchemy/orm/decl_base.py", line 1091, in raise_unmapped_for_cls
class_._sa_raise_deferred_config()
File "/Users/gallegoj/.pyenv/versions/3.10.14/envs/valis/lib/python3.10/site-packages/sqlalchemy/ext/declarative/extensions.py", line 307, in _sa_raise_deferred_config
raise orm_exc.UnmappedClassError(
sqlalchemy.orm.exc.UnmappedClassError: Class sdssdb.sqlalchemy.sdss5db.catalogdb.Gaia_DR3 is a subclass of AbstractConcreteBase and has a mapping pending until all subclasses are defined. Call the sqlalchemy.orm.configure_mappers() function after all subclasses have been defined to complete the mapping of this class.
Running configure_mappers() doesn't seem to help.
- Dominant language
- Python
- Stars
- 8
- Forks
- 2
- Avg merge
- 10d 31m
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sdss/sdssdb
-
psycopg3 issuesOpen
Difficulty 3/5 1-2 days Newbie friendliness 42/100
-
Reloading the database doesn't trigger reflectionMay be free again @albireox claimed this 143 days ago, and no pull request is open. Open
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
question
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
NVIDIA/flare-local-inference#90 ·
Maintainers usually reply within 1 day
-
area/streaming comp/gateway P2 platform/telegram type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NousResearch/hermes-agent#144897 ·
Maintainers usually reply within 1 day
-
request-theme
Difficulty 1/5 Under an hour Newbie friendliness 66/100
LizardByte/ThemerrDB#9575 ·
Maintainers usually reply within 1 day
-
author-page correction
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
acl-org/acl-anthology#10599 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
zilliztech/memsearch#818 ·
Maintainers usually reply within 1 day