On Monday, July 22, 2019 at 7:47:51 PM UTC-4, Isaac Martin wrote:
>
>  or straight-forward way of generating avro schema from a sqlalchemy model?
>

You can iterate the columns and relations of a SqlAlchemy model / table.  
Search terms like "iterate sqlachemy model columns" and you'll see many 
examples.  Some advanced items may require the inspect feature (
https://docs.sqlalchemy.org/en/13/core/inspection.html)

In terms of implementing it, you could make an external function that reads 
your model package... or make a mixin class that offers a method for 
generating it, and just inherit from that.  I do the latter for creating 
json 'fingerprints' of a model that seem similar to what the avro schema 
format looks like.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/16f0a4a5-d9e0-4f6d-b911-4cbd20202488%40googlegroups.com.

Reply via email to