sqlacodegen error : AttributeError: 'Table' object has no attribute 'bind'

728 views
Skip to first unread message

Yoav Kopfstein

unread,
Feb 22, 2023, 11:25:24 AM2/22/23
to sqlalchemy
I am using sqlacodegen for the first time to generate Python class models from an existing PostgreSQL database. 

when running this :
% sqlacodegen  --schema=<schema_name> --tables <table_name> postgresql://<user>:<password>@<host>


I am getting this error:
Traceback (most recent call last):
  File "***/bin/sqlacodegen", line 8, in <module>
    sys.exit(main())
  File "***/lib/python3.9/site-packages/sqlacodegen/main.py", line 51, in main
    generator = CodeGenerator(metadata, args.noindexes, args.noconstraints, args.nojoined,
  File "***/lib/python3.9/site-packages/sqlacodegen/codegen.py", line 437, in __init__
    model = self.class_model(table, links[table.name], self.inflect_engine,
  File "***/lib/python3.9/site-packages/sqlacodegen/codegen.py", line 201, in __init__
    super(ModelClass, self).__init__(table)
  File "***/lib/python3.9/site-packages/sqlacodegen/codegen.py", line 100, in __init__
    column.type = self._get_adapted_type(column.type, column.table.bind)
AttributeError: 'Table' object has no attribute 'bind'



Can you please advise?

Mike Bayer

unread,
Feb 24, 2023, 11:59:55 AM2/24/23
to noreply-spamdigest via sqlalchemy
Please refer to https://github.com/agronholm/sqlacodegen/discussions for sqlacodegen support.
--
NOTICE: This email and all attachments are confidential and may contain information that is privileged, confidential, or exempt from disclosure under law. If you are not the intended recipient, delete this message and notify the sender immediately. Any unauthorized use is strictly prohibited.


--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
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+...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages