Comments (4)
What is the error you get? According to SQLAlchemy documentation, passing the secondary table by its name is perfectly legit.
from sqlacodegen.
The complete stack trace of the error, using the original generated file, in a basic test reading the table content, is:
Traceback (most recent call last):
File "F:/desarrollo flask-ubu-novamag-17-18/ubu-flask-experiments/persistence/test_database.py", line 28, in
for instance in session.query(Atom):
File "G:\Flask\myproject27\venv\lib\site-packages\sqlalchemy\orm\session.py", line 1362, in query
return self._query_cls(entities, self, **kwargs)
File "G:\Flask\myproject27\venv\lib\site-packages\sqlalchemy\orm\query.py", line 139, in init
self._set_entities(entities)
File "G:\Flask\myproject27\venv\lib\site-packages\sqlalchemy\orm\query.py", line 150, in _set_entities
self._set_entity_selectables(self._entities)
File "G:\Flask\myproject27\venv\lib\site-packages\sqlalchemy\orm\query.py", line 180, in _set_entity_selectables
ent.setup_entity(*d[entity])
File "G:\Flask\myproject27\venv\lib\site-packages\sqlalchemy\orm\query.py", line 3585, in setup_entity
self._with_polymorphic = ext_info.with_polymorphic_mappers
File "G:\Flask\myproject27\venv\lib\site-packages\sqlalchemy\util\langhelpers.py", line 764, in get
obj.dict[self.name] = result = self.fget(obj)
File "G:\Flask\myproject27\venv\lib\site-packages\sqlalchemy\orm\mapper.py", line 1948, in _with_polymorphic_mappers
configure_mappers()
File "G:\Flask\myproject27\venv\lib\site-packages\sqlalchemy\orm\mapper.py", line 2872, in configure_mappers
mapper._post_configure_properties()
File "G:\Flask\myproject27\venv\lib\site-packages\sqlalchemy\orm\mapper.py", line 1765, in _post_configure_properties
prop.init()
File "G:\Flask\myproject27\venv\lib\site-packages\sqlalchemy\orm\interfaces.py", line 184, in init
self.do_init()
File "G:\Flask\myproject27\venv\lib\site-packages\sqlalchemy\orm\relationships.py", line 1653, in do_init
self._process_dependent_arguments()
File "G:\Flask\myproject27\venv\lib\site-packages\sqlalchemy\orm\relationships.py", line 1678, in _process_dependent_arguments
setattr(self, attr, attr_value())
File "G:\Flask\myproject27\venv\lib\site-packages\sqlalchemy\ext\declarative\clsregistry.py", line 293, in call
(self.prop.parent, self.arg, n.args[0], self.cls)
sqlalchemy.exc.InvalidRequestError: When initializing mapper Mapper|Author|authors, expression 'authoring' failed to locate a name ("name 'authoring' is not defined"). If this is a class name, consider adding this relationship() to the <class 'persistence.novamag_search_error.Author'> class after both dependent classes have been defined.
If I modify the code as previously has been indicated, the error dissapears.
Greetings.
from sqlacodegen.
from sqlacodegen.
It seems that the problem was the lack of the explicit schema qualifier. The problem has been fixed 3 years ago.
from sqlacodegen.
Related Issues (20)
- Error in Generated SQLAlchemy Model for CHAR Column HOT 2
- Constraints Issues with Oracle HOT 1
- Unable to install `sqlacodegen` due to ioutdated PyPI release HOT 2
- Add support for multiple databases binding
- Entry point documentation
- Enhancement: Add Support for pgvector extension HOT 2
- SQLModel codegen produces syntax errors HOT 6
- Syntax Error in 3.0.0rc3 HOT 5
- No poetry package which supports SQLAlchemy 2.0 HOT 5
- AssertionError: TypeDecorator implementations require a class-level variable 'impl' HOT 14
- sqlalchemy.exc.OperationalError HOT 6
- Database URL is split on & HOT 1
- No module named 'pkg_resources' HOT 2
- ImportError: cannot import name 'ArgSpec' from 'inspect' HOT 1
- Can we push more versions to PyPi HOT 5
- Using types instead of strings in return values of methods in generators
- Issue when generating Postgres DOMAIN type HOT 2
- Could not assemble any primary key when using the SQLModel generator
- UUID for postgreSQL HOT 1
- Attribute error module 'sqlalchemy' has no attribute '__all__'. Did you mean: '__file__'? for mysql HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlacodegen.