rethinkmodel.manage - Automatic database and table creation¶
Automatic database initialisation tools.
This module proposes some functions to automatically create database and tables by introspecting modules. It can be used in Python, or from command line (in progress).
The way to go is th create a python script, named “manage.py” for example, that will do the job. For example:
import rethinkmodel
from rethinkmodel.manage as manage
import myproject.dataModule # this is your module
# you should configure your RethinkDB connection here
rethinkmodel.config(...)
# Check if the configured database exists
manage.check_db()
# this will introspect module to find
# each "Model" object and create tables.
# It will also create database
manage(myproject.dataModule)
-
rethinkmodel.manage.
auto
(member: Type[rethinkmodel.model.Model])[source]¶ Automatic database and table creation for the given type (Modelchild).