agronholm / sqlacodegen

Automatic model code generator for SQLAlchemy
Other
1.86k stars 241 forks source link

ImportError: cannot import name 'ArgSpec' from 'inspect' #326

Open Abhiz2411 opened 4 months ago

Abhiz2411 commented 4 months ago

Things to check first

Sqlacodegen version

2.3.0.post1

SQLAlchemy version

1.4.52

RDBMS vendor

PostgreSQL

What happened?

When I ran the command sqlacodegen postgresql://postgres:secret_pass@localhost:5432/db_name > model.py It should have created code in model.py. I researched about the error and I think it is caused because codegen.py has an import statement from inspect import ArgSpec where ArgSpec is depreciated for python 3.12.2. I am using 3.12.2 version of python

Database schema for reproducing the bug

No response

trembel commented 3 months ago

For me it is solved using the rc version. Try pip install sqlacodegen==3.0.0rc5, see here: https://github.com/agronholm/sqlacodegen/discussions/251