Replies: 1 comment
-
Im going to close this one, for anyone that have this problem again... if isinstance(table.c[colname.lower()].type, String): After that everything was generated successfully. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys,
Um using sqlcodeagen_v2 for an oracle db.
Tables with no check constraint get generated fine, however, everytime I try to generate a table with a column constraint fails. Is ok if I use the noconstraints option, but because im using Django with SqlAlchemy I really need the primary key generated (which on oracle is not included if the noconstraints option is given). Any suggestions?
Example:
C:\Windows\System32>sqlacodegen_v2 --option nocomments --tables tr_tolling_product_types --outfile c:\models.py oracle+oracledb://:@...:1521/?service_name=*
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Python\Python313\Scripts\sqlacodegen_v2.exe_main.py", line 7, in
sys.exit(main())
~~~~^^
File "C:\Python\Python313\Lib\site-packages\sqlacodegen_v2\cli.py", line 75, in main
outfile.write(generator.generate())
~~~~~~~~~~~~~~~~~~^^
File "C:\Python\Python313\Lib\site-packages\sqlacodegen_v2\generators.py", line 146, in generate
self.fix_column_types(table)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^
File "C:\Python\Python313\Lib\site-packages\sqlacodegen_v2\generators.py", line 584, in fix_column_types
if isinstance(table.c[colname].type, String):
~~~~~~~^^^^^^^^^
File "C:\Python\Python313\Lib\site-packages\sqlalchemy\sql\base.py", line 1608, in getitem
return self._index[key][1]
~~~~~~~~~~~^^^^^
KeyError: 'TXT_TOLLING_PRODUCT_PURPOSE'
However on table with no check constraint
C:\Windows\System32>sqlacodegen_v2 --option nocomments --tables tsi_stations --outfile c:\models.py oracle+oracledb://:@...:1521/?service_name=*
C:\Windows\System32>
Beta Was this translation helpful? Give feedback.
All reactions