|
Ravel Python API Reference
A Database-Defined Network Controller
|
A representation of Ravel's backend PostgreSQL database. More...
Public Member Functions | |
| def | __init__ |
| def | conn |
| returns: a psycopg2 connection to the PostgreSQL database | |
| def | cursor |
| def | num_connections |
| Returns the number of existing connections to the database. More... | |
| def | init |
| Initialize the database with the base Ravel SQL implementation. More... | |
| def | load_schema |
| Load the specified schema into the database". More... | |
| def | load_topo |
| Load a topology from the specified network provider. More... | |
| def | create |
| If not created, create a database with the name specified in the constructor. | |
| def | add_extensions |
| If not already added, add extensions required by Ravel (plpythonu, postgis, pgrouting) | |
| def | clean |
| Clean the database of any existing Ravel components. | |
| def | truncate |
| Clean the database of any state Ravel components, except for topology tables. More... | |
A representation of Ravel's backend PostgreSQL database.
| def ravel.db.RavelDb.__init__ | ( | self, | |
| name, | |||
| user, | |||
| base, | |||
passwd = None, |
|||
reconnect = False |
|||
| ) |
| name | the name of the database to connect to |
| user | the username to use to connect |
| base | a file containing the SQL implementation for Ravel's base |
| passwd | the password to connect to the database |
| reconnect | true to connect to an existing database setup, false to load a new instance of Ravel's base into the database |
| def ravel.db.RavelDb.cursor | ( | self | ) |
| def ravel.db.RavelDb.init | ( | self | ) |
Initialize the database with the base Ravel SQL implementation.
Removes any existing Ravel objects from the database
| def ravel.db.RavelDb.load_schema | ( | self, | |
| script | |||
| ) |
Load the specified schema into the database".
| script | path to a SQL script |
| def ravel.db.RavelDb.load_topo | ( | self, | |
| provider | |||
| ) |
Load a topology from the specified network provider.
| provider | a ravel.network.NetworkProvider instance |
| def ravel.db.RavelDb.num_connections | ( | self | ) |
Returns the number of existing connections to the database.
If there are >1 connections, a new Ravel base implementation cannot be loaded into the database.
| def ravel.db.RavelDb.truncate | ( | self | ) |
Clean the database of any state Ravel components, except for topology tables.
This rolls back the database to the state after the topology is first loaded
1.8.6