jsonschema2db
jsonschema2db copied to clipboard
where to pass table name? can you give simple ?
I am using jsonschema2db package, I tried to create a table in the example it's given by you in jsonschema2db documentation, it's working fine but I don't understand much about an example because you using reference also. where to pass table name it's default taking table name is root. can you give simple example using JSON like {'id':{'type':'string'},'name':{'type':'string'}} for example 2 or 3 column enough.
@rmohamedfazil To achieve custom root schema name, you might need to modify JSONSchemaToDatabase
constructor in jsonschema2db.py
by doing the following:
- add a new constructor parameter e.g.
root_table_name
- override the default value (
'root'
) fortable
parameter of_traverse
method by passing this new argument:self._translation_tree = self._traverse(schema, schema, comment=schema.get('comment'), table=root_table_name)