Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where to pass table name? can you give simple ? #26

Open
rmohamedfazil opened this issue Apr 23, 2019 · 1 comment
Open

where to pass table name? can you give simple ? #26

rmohamedfazil opened this issue Apr 23, 2019 · 1 comment

Comments

@rmohamedfazil
Copy link

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.

@BojanKomazec
Copy link

@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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants