Getting started

GnrSqlDb is the main class of gnr.sql.gnrsql module. A GnrSqlDb instance has the following purposes:

  • manage the logical structure of a database, called database's model.
  • manage operations on db at high level, hiding adapter's layer and connections.

First of all you have to create a GnrSqlDb instance:

mydb = GnrSqlDb(implementation='sqlite', dbname='example', 
                user='foo', password='bar')

The constructor method has the following parameters:

  • implementation: at this time there are only adapters for Sqlite or Postgres.
  • dbname: the database name.
  • host: the address of the db.
  • user: user name.
  • password: password.
  • port: connection port
  • main_schema: the main_schema of db