Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using sqlacodegen to generate models from Teradata database #56

Closed
Nirmalendu opened this issue Jan 17, 2018 · 1 comment
Closed

Using sqlacodegen to generate models from Teradata database #56

Nirmalendu opened this issue Jan 17, 2018 · 1 comment
Labels

Comments

@Nirmalendu
Copy link

I am unable to find any resource which shows how to use sqlacodegen with Teradata. I tried this syntax:

sqlacodegen teradata://<username>:<password>@host --outfile models.py

This gives the following error trace:

Traceback (most recent call last): File "c:\users\212628419\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\users\212628419\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\212628419\AppData\Local\Programs\Python\Python36\Scripts\sqlacodegen.exe__main__.py", line 9, in File "c:\users\212628419\appdata\local\programs\python\python36\lib\site-packages\sqlacodegen\main.py", line 40, in main metadata.reflect(engine, args.schema, not args.noviews, tables) File "c:\users\212628419\appdata\local\programs\python\python36\lib\site-packages\sqlalchemy\sql\schema.py", line 3962, in reflect Table(name, self, **reflect_opts) File "c:\users\212628419\appdata\local\programs\python\python36\lib\site-packages\sqlalchemy\sql\schema.py", line 456, in new metadata._remove_table(name, schema) File "c:\users\212628419\appdata\local\programs\python\python36\lib\site-packages\sqlalchemy\util\langhelpers.py", line 66, in exit compat.reraise(exc_type, exc_value, exc_tb) File "c:\users\212628419\appdata\local\programs\python\python36\lib\site-packages\sqlalchemy\util\compat.py", line 187, in reraise raise value File "c:\users\212628419\appdata\local\programs\python\python36\lib\site-packages\sqlalchemy\sql\schema.py", line 451, in new table._init(name, metadata, *args, **kw) File "c:\users\212628419\appdata\local\programs\python\python36\lib\site-packages\sqlalchemy\sql\schema.py", line 533, in _init include_columns, _extend_on=_extend_on) File "c:\users\212628419\appdata\local\programs\python\python36\lib\site-packages\sqlalchemy\sql\schema.py", line 546, in _autoload _extend_on=_extend_on File "c:\users\212628419\appdata\local\programs\python\python36\lib\site-packages\sqlalchemy\engine\base.py", line 1545, in run_callable return callable_(self, *args, **kwargs) File "c:\users\212628419\appdata\local\programs\python\python36\lib\site-packages\sqlalchemy\engine\default.py", line 389, in reflecttable table, include_columns, exclude_columns, **opts) File "c:\users\212628419\appdata\local\programs\python\python36\lib\site-packages\sqlalchemy\engine\reflection.py", line 618, in reflecttable table_name, schema, **table.dialect_kwargs): File "c:\users\212628419\appdata\local\programs\python\python36\lib\site-packages\sqlalchemy\engine\reflection.py", line 374, in get_columns col_def['type'] = coltype() TypeError: 'NoneType' object is not callable

I understand that we need to specify the driver for connecting to teradata, but the following syntax:
sqlacodegen: error: unrecognized arguments: Database\ ODBC\ Driver\ 16.10 --op.py

Is there a way to generate the models file from sqlalchemy-teradata? I tried automap and reflections both of which gives the same error trace as the first except for the first line in error trace being:

File "C:\Users\212628419\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\ext\automap.py", line 754, in prepare autoload_replace=False

@agronholm
Copy link
Owner

As you can see from the traceback, the problem lies with SQLAlchemy reflection and there is nothing I can do about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants