My search skills are failing me, and I hope you all can help.
(Apologies that there is some heresy here)
Assumptions:
1) Suppose I have objects made from json (dicts of strings, lists of
dicts, etc.)
2) (for simplicity, assume these nestings don't go very deep)
3) getting this right 90% of the time is fine, and it can assume there are
only 1:1 and 1:many.
Question:
Is there a tool, or what is the easiest way to create / autogenerate a
sensible schema based on the object?
I am looking for a function with this sort of signature:
obj = {'id':1,
'name': 'Gregg',
'events': ['ts': 129292939392, 'what': 'keypress'},
{'ts': 129292939394, 'what': 'click'}]
}
def gen_schemas_and_create_table_statements(obj=obj, primary_key='id')
that would give something like:
* 2 (or maybe 3) tables: table1: pk id, string name ; table2
(events): foreign id, ts, what
along with the sql to create them.
(this is inspired by all the grossness I deal with in Hive).
Thanks!
GL
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sqlalchemy/-/tuAozc5iqfEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.