Skip to content

Commit d1fa1cf

Browse files
authored
Merge pull request #48 from apanly/master
support SQLAlchemy 2.0 and Support Python 3.9
2 parents c087fe7 + e5403c8 commit d1fa1cf

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Flask sqlacodegen
22

33
Fork of [sqlacodegen](https://pypi.python.org/pypi/sqlacodegen) by Alex Gronholm. Based off of version 1.1.6.
4+
> Now Support Python 3.9 or lastest
5+
6+
> Now Support SQLAlchemy 2.0 or lastest
7+
8+
Thanks
9+
10+
* https://github.com/maacck/sqlacodegen_v2/
11+
* https://github.com/ksindi/flask-sqlacodegen/pull/47
12+
413

514
What's different:
615

setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,16 @@ def run_tests(self):
4545
'Programming Language :: Python :: 3.5',
4646
'Programming Language :: Python :: 3.6',
4747
'Programming Language :: Python :: 3.7',
48+
'Programming Language :: Python :: 3.9',
49+
'Programming Language :: Python :: 3.10',
50+
'Programming Language :: Python :: 3.11',
4851
],
4952
keywords=['sqlalchemy', 'sqlacodegen', 'flask'],
5053
license='MIT',
5154
packages=find_packages(exclude=['tests']),
5255
install_requires=(
53-
'SQLAlchemy >= 0.6.0',
54-
'inflect >= 0.2.0'
56+
"SQLAlchemy >= 2.0",
57+
"inflect >= 4.0.0",
5558
) + extra_requirements,
5659
tests_require=['pytest', 'pytest-pep8'],
5760
cmdclass={'test': PyTest},

sqlacodegen/codegen.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Contains the code generation logic and helper functions."""
22
from __future__ import unicode_literals, division, print_function, absolute_import
33
from collections import defaultdict
4-
from inspect import ArgSpec
54
from keyword import iskeyword
65
import inspect
76
import sys
@@ -95,12 +94,12 @@ def _get_common_fk_constraints(table1, table2):
9594

9695
def _getargspec_init(method):
9796
try:
98-
return inspect.getargspec(method)
97+
return inspect.getfullargspec(method)
9998
except TypeError:
10099
if method is object.__init__:
101-
return ArgSpec(['self'], None, None, None)
100+
return inspect.getfullargspec(lambda self: None)
102101
else:
103-
return ArgSpec(['self'], 'args', 'kwargs', None)
102+
return inspect.getfullargspec(lambda self, *args, **kwargs: None)
104103

105104

106105
def _render_column_type(coltype):

sqlacodegen/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def main():
5656

5757
engine = create_engine(args.url)
5858
import_dialect_specificities(engine)
59-
metadata = MetaData(engine, False, default_schema)
59+
metadata = MetaData()
6060
tables = args.tables.split(',') if args.tables else None
6161
ignore_cols = args.ignore_cols.split(',') if args.ignore_cols else None
6262
metadata.reflect(engine, args.schema, not args.noviews, tables)

0 commit comments

Comments
 (0)