File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44from setuptools import setup , find_packages
55
6+ import sqlacodegen
7+
68
79extra_requirements = ()
810dependency_links = []
911if sys .version_info < (2 , 7 ):
1012 extra_requirements = ('argparse' ,)
1113elif sys .version_info > (3 ,):
12- dependency_links = ['https://github.com/benthor/inflect.py/archive/master.zip#egg=inflect-0.2.3 ' ]
14+ dependency_links = ['https://github.com/benthor/inflect.py/archive/master.zip#egg=inflect-0.2.4 ' ]
1315
1416here = os .path .dirname (__file__ )
1517readme_path = os .path .join (here , 'README.rst' )
1921 name = 'sqlacodegen' ,
2022 description = 'Automatic model code generator for SQLAlchemy' ,
2123 long_description = readme ,
22- version = '1.1.0.pre3' ,
24+ version = sqlacodegen . version ,
2325 author = 'Alex Gronholm' ,
2426 author_email = 'sqlacodegen@nextday.fi' ,
2527 url = 'http://pypi.python.org/pypi/sqlacodegen/' ,
Original file line number Diff line number Diff line change 1+ version = '1.1.0'
Original file line number Diff line number Diff line change 77from sqlalchemy .schema import MetaData
88
99from sqlacodegen .codegen import CodeGenerator
10+ import sqlacodegen
1011
1112
1213def main ():
1314 parser = argparse .ArgumentParser (description = 'Generates SQLAlchemy model code from an existing database.' )
14- parser .add_argument ('url' , help = 'SQLAlchemy url to the database' )
15+ parser .add_argument ('url' , nargs = '?' , help = 'SQLAlchemy url to the database' )
16+ parser .add_argument ('--version' , action = 'store_true' , help = "print the version number and exit" )
1517 parser .add_argument ('--schema' , help = 'load tables from an alternate schema' )
1618 parser .add_argument ('--tables' , help = 'tables to process (comma-separated, default: all)' )
1719 parser .add_argument ('--noviews' , action = 'store_true' , help = "ignore views" )
@@ -23,6 +25,14 @@ def main():
2325 help = 'file to write output to (default: stdout)' )
2426 args = parser .parse_args ()
2527
28+ if args .version :
29+ print (sqlacodegen .version )
30+ return
31+ if not args .url :
32+ print ('You must supply a url\n ' , file = sys .stderr )
33+ parser .print_help ()
34+ return
35+
2636 engine = create_engine (args .url )
2737 metadata = MetaData (engine )
2838 tables = args .tables .split (',' ) if args .tables else None
You can’t perform that action at this time.
0 commit comments