Warning

This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

galaxy.model.orm package

galaxy.model.orm - ORM-related functionality

Submodules

galaxy.model.orm.engine_factory module

galaxy.model.orm.engine_factory.reset_request_query_counts()[source]
galaxy.model.orm.engine_factory.log_request_query_counts(req_id)[source]
galaxy.model.orm.engine_factory.build_engine(url, engine_options, database_query_profiling_proxy=False, trace_logger=None, slow_query_log_threshold=0, thread_local_log=None, log_query_counts=False)[source]

galaxy.model.orm.logging_connection_proxy module

galaxy.model.orm.logging_connection_proxy.stripwd(s)[source]
galaxy.model.orm.logging_connection_proxy.pretty_stack()[source]
class galaxy.model.orm.logging_connection_proxy.LoggingProxy[source]

Bases: sqlalchemy.interfaces.ConnectionProxy

Logs SQL statements using standard logging module

begin(conn, begin)[source]

Intercept begin() events.

commit(conn, commit)[source]

Intercept commit() events.

rollback(conn, rollback)[source]

Intercept rollback() events.

cursor_execute(execute, cursor, statement, parameters, context, executemany)[source]

Intercept low-level cursor execute() events.

class galaxy.model.orm.logging_connection_proxy.TraceLoggerProxy(trace_logger)[source]

Bases: sqlalchemy.interfaces.ConnectionProxy

Logs SQL statements using a metlog client

__init__(trace_logger)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

cursor_execute(execute, cursor, statement, parameters, context, executemany)[source]

Intercept low-level cursor execute() events.

galaxy.model.orm.now module

galaxy.model.orm.now.now()

Return a new datetime representing UTC day and time.

galaxy.model.orm.scripts module

Code to support database helper scripts (create_db.py, manage_db.py, etc…).

galaxy.model.orm.scripts.get_config(argv, use_argparse=True, cwd=None)[source]

Read sys.argv and parse out repository of migrations and database url.

>>> import os
>>> from six.moves.configparser import SafeConfigParser
>>> from shutil import rmtree
>>> from tempfile import mkdtemp
>>> config_dir = mkdtemp()
>>> os.makedirs(os.path.join(config_dir, 'config'))
>>> def write_ini(path, property, value):
...     p = SafeConfigParser()
...     p.add_section('app:main')
...     p.set('app:main', property, value)
...     with open(os.path.join(config_dir, 'config', path), 'w') as f: p.write(f)
>>> write_ini('tool_shed.ini', 'database_connection', 'sqlite:///pg/testdb1')
>>> config = get_config(['manage_db.py', 'tool_shed'], cwd=config_dir)
>>> config['repo'].endswith('tool_shed/webapp/model/migrate')
True
>>> config['db_url']
'sqlite:///pg/testdb1'
>>> write_ini('galaxy.ini', 'data_dir', '/moo')
>>> config = get_config(['manage_db.py'], cwd=config_dir)
>>> uri_with_env = os.getenv("GALAXY_TEST_DBURI", "sqlite:////moo/universe.sqlite?isolation_level=IMMEDIATE")
>>> config['db_url'] == uri_with_env
True
>>> config['repo'].endswith('galaxy/model/migrate')
True
>>> rmtree(config_dir)
galaxy.model.orm.scripts.manage_db()[source]