simpleml.utils.postgres module

Util module to manage postgres specific functions

simpleml.utils.postgres.create_database(connection_params, database, owner=None)[source]

Creates a new database :return: None

simpleml.utils.postgres.create_user(connection_params, user, password)[source]

Creates a new user :return: None

simpleml.utils.postgres.drop_database(connection_params, database, force=False)[source]

Drop database – Must have sufficient privileges :return: None

simpleml.utils.postgres.drop_user(connection_params, user)[source]

Drop a user – Must have sufficient privileges :return: None

simpleml.utils.postgres.run_sql_command(connection_params, command, autocommit=False)[source]

Execute command directly using psycopg2 cursor

Parameters:
  • connection_params – dict of connection details
  • command – raw sql to execute
  • autocommit – default false; determines if the connection automcommits

commands. Necessary for certain commands (create/drop db)