We have several third-party vendors that provide us with large, normalized
schema (100+) tables. I am looking to quickly discover probable foreign
keys based on a column's name and data type attributes.
For the data type attributes, I am looking to extract any attribute values
set on the data type object. For instance:
import sqlalchemy as sa
char = sa.CHAR(2)
print(char.__dict__)
>>> {'unicode_error': None, 'collation': None, 'convert_unicode': False,
'_warn_on_bytestring': False, 'length': 2}
In this instance, I want to programmatically separate the length attribute
as an actual database type attribute from convert_unicode.
Digging through the code base the best example I could find for this
behavior is in util.generic_repr where a similar function could output an
ordered dict versus a formatted string. Is there a more direct way/existing
function in Sqlalchemy to accomplish this or something that could be useful
to add to the library? If not, can I have permission to reference and
modify the existing code in util.generic_repr?
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.