alchemyjsonschema
alchemyjsonschema copied to clipboard
Error with the northwind schema
@podhmo , first thanks for sharing your code.
- I have set a northwind database in mysql with https://github.com/dalers/mywind
- Then I generated the Sqlalchemy model classes using https://github.com/agronholm/sqlacodegen which gave me models.py (attached)
- I then used your code to generate the schema
alchemyjsonschema --walker structural models.py - Python is 3.11 and I use the latest version of sqlalchemy
I get an error I have no clue, as all the previous models, on the same pattern seems working:
PS D:\Dev\SeaDevDev\newAppGen\app> alchemyjsonschema --walker structural models.py
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "D:\Dev\SeaDevDev\newAppGen\venv\Scripts\alchemyjsonschema.exe\__main__.py", line 7, in <module>
File "D:\Dev\SeaDevDev\newAppGen\venv\Lib\site-packages\alchemyjsonschema\command\main.py", line 29, in main
driver.run(args.target, args.out, format=args.format)
File "D:\Dev\SeaDevDev\newAppGen\venv\Lib\site-packages\alchemyjsonschema\command\driver.py", line 58, in run
data = self.load(module_path)
^^^^^^^^^^^^^^^^^^^^^^
File "D:\Dev\SeaDevDev\newAppGen\venv\Lib\site-packages\alchemyjsonschema\command\driver.py", line 69, in load
return magicalimport.import_module(module_path, cwd=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Dev\SeaDevDev\newAppGen\venv\Lib\site-packages\magicalimport\__init__.py", line 125, in import_module
m = import_from_physical_path(module_path, here=here, _depth=_depth, cwd=cwd)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Dev\SeaDevDev\newAppGen\venv\Lib\site-packages\magicalimport\__init__.py", line 117, in import_from_physical_path
return _create_module(module_id, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Dev\SeaDevDev\newAppGen\venv\Lib\site-packages\magicalimport\compat.py", line 20, in _create_module
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "D:\Dev\SeaDevDev\newAppGen\app\models.py", line 160, in <module>
class Supplier(Base):
File "D:\Dev\SeaDevDev\newAppGen\app\models.py", line 164, in Supplier
company = Column(String(50), index=True)
^^^^^^^^^^
TypeError: __init__() takes 1 positional argument but 2 were given
This is the models models.zip
If you can spend some time on it I would appreciate. Thanks in advance
Writing this "bug report" I just discovered String was redefined just above Supplier definition: so I think this is not at all related to your code! I keep you posted
It works well except for some types which are not supported