Database([filename, host, user, password, ...]) | Class to handle all python communication with a database. |
Provide a simple database interface to access sqlite3 and PostgreSQL databases.
If the database object is initialized with a host variable, the database object assumes a PostgreSQL database connection.
Class to handle all python communication with a database.
Close the database.
Execute an sql statement
Properties
Parameter | Description |
---|---|
sql | SQL statement to execute. |
Execute a list of SQL statements.
Properties
Parameter | Description |
---|---|
sql_list | List of SQL commands to process. |
blocksize | Maximum size of a block os SQL commands that gets processed in one go. Longer lists are split in multiple blocks [default=128]. |
verbose | Boolean that [default=False]. |
Insert a new record into the database and return the new primary key.
Properties
Parameter | Description |
---|---|
sql | SQL statement to execute. |
Check if database is a PostgreSQL database.
Check if database is an SQLite3 database.
Open the database.
Select records from the database.
Properties
Parameter | Description |
---|---|
sql | SQL statement to execute. |
Select one record from the database.
Properties
Parameter | Description |
---|---|
sql | SQL statement to execute. |
Select records from the database.
Properties
Parameter | Description |
---|---|
table | Check if table exists |
Write SQL script to a file.
Properties
Parameter | Description |
---|---|
filename | Name of the file to which to write the sql_script. |
sql_script | Script with SQL statements. |