weaver.engines package

Submodules

weaver.engines.postgres module

class weaver.engines.postgres.engine

Bases: weaver.lib.engine.Engine

Engine instance for PostgreSQL.

abbreviation = 'postgres'
create_db()

Create Engine database.

create_db_statement()

In PostgreSQL, the equivalent of a SQL database is a schema.

CREATE SCHEMA table_name;

drop_statement(objecttype, objectname)

In PostgreSQL, the equivalent of a SQL database is a schema.

get_connection()

Get db connection. Please update the encoding lookup table if the required encoding is not present.

max_int = 2147483647
name = 'PostgreSQL'
placeholder = '%s'
required_opts = [('user', 'Enter your PostgreSQL username', 'postgres'), ('password', 'Enter your password', ''), ('host', 'Enter your PostgreSQL host', 'localhost'), ('port', 'Enter your PostgreSQL port', 5432), ('database', 'Enter your PostgreSQL database name', 'postgres'), ('database_name', 'Format of schema name', '{db}'), ('table_name', 'Format of table name', '{db}.{table}')]

weaver.engines.sqlite module

class weaver.engines.sqlite.engine

Bases: weaver.lib.engine.Engine

Engine instance for SQLite.

abbreviation = 'sqlite'
create_db()

Don’t create database for SQLite

SQLite doesn’t create databases. Each database is a file and needs a separate connection. This overloads`create_db` to do nothing in this case.

datatypes = {'auto': ('INTEGER', 'AUTOINCREMENT'), 'bigint': 'INTEGER', 'bool': 'INTEGER', 'char': 'TEXT', 'decimal': 'REAL', 'double': 'REAL', 'int': 'INTEGER'}
get_connection()

Get db connection.

name = 'SQLite'
placeholder = '?'
required_opts = [('file', 'Enter the filename of your SQLite database', './sqlite.db', ''), ('table_name', 'Format of table name', '{db}_{table}')]
to_csv()

Module contents

Contains DBMS-specific Engine implementations.

weaver.engines.choose_engine(opts, choice=True)

Prompts the user to select a database engine