jsonschema2db icon indicating copy to clipboard operation
jsonschema2db copied to clipboard

where to pass table name? can you give simple ?

Open rmohamedfazil opened this issue 5 years ago • 1 comments

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 avatar Apr 23 '19 11:04 rmohamedfazil

@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') for table parameter of _traverse method by passing this new argument: self._translation_tree = self._traverse(schema, schema, comment=schema.get('comment'), table=root_table_name)

BojanKomazec avatar May 03 '19 20:05 BojanKomazec