Sqlalchemy has recently added support for computed column defaults, which are 
different than regular SQL defaults. The sqlacodegen tool will need to be 
updated to support this concept. You can request this via their issue tracker, 
where it seems this is already being discussed at 
https://github.com/agronholm/sqlacodegen/issues/116 .

On Wed, Jul 1, 2020, at 3:49 PM, Ivy Chang wrote:
> Hello, I'm running sqlacodegen for the first time, and it works successfully 
> for most tables, but for some tables I'm getting the following error:
> 
> >sqlacodegen mssql+pymssql://... --outfile db.py --tables MyTable
> 
> Traceback (most recent call last):
>  File "C:\Python37\lib\runpy.py", line 193, in _run_module_as_main
>  "__main__", mod_spec)
>  File "C:\Python37\lib\runpy.py", line 85, in _run_code
>  exec(code, run_globals)
>  File "d:\dev\E2EAPIs\env\Scripts\sqlacodegen.exe\__main__.py", line 9, in 
> <module>
>  File "d:\dev\e2eapis\env\lib\site-packages\sqlacodegen\main.py", line 53, in 
> main
>  generator.render(outfile)
>  File "d:\dev\e2eapis\env\lib\site-packages\sqlacodegen\codegen.py", line 
> 699, in render
>  rendered_models.append(self.render_class(model))
>  File "d:\dev\e2eapis\env\lib\site-packages\sqlacodegen\codegen.py", line 
> 679, in render_class
>  self.indentation, attr, self.render_column(column, show_name))
>  File "d:\dev\e2eapis\env\lib\site-packages\sqlacodegen\codegen.py", line 
> 573, in render_column
>  default_expr = self._get_compiled_expression(column.server_default.arg)
> *AttributeError: 'Computed' object has no attribute 'arg'*
> **
> Any suggestions? Thank you!
> 

> --
>  SQLAlchemy - 
>  The Python SQL Toolkit and Object Relational Mapper
> 
> http://www.sqlalchemy.org/
> 
>  To post example code, please provide an MCVE: Minimal, Complete, and 
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
> description.
>  --- 
>  You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
>  To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/0ca6b987-f70c-4d83-918a-3cc175593d96n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/sqlalchemy/0ca6b987-f70c-4d83-918a-3cc175593d96n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/6c3d5311-0358-4653-ba31-814b6fee09ba%40www.fastmail.com.

Reply via email to