Package glue :: Package ligolw :: Package utils :: Module ligolw_sqlite
[hide private]
[frames] | no frames]

Module ligolw_sqlite

source code

Convert tabular data in LIGO LW XML files to and from SQL databases.

This module provides a library interface to the machinery used by the ligolw_sqlite command-line tool, facilitating it's re-use in other applications. The real XML<-->database translation machinery is implemented in the glue.ligolw.dbtables module. The code here wraps the machinery in that mdoule in functions that are closer to the command-line level operations provided by the ligolw_sqlite program.


Version: git id 8cbd1b7187ce3ed9a825d6ed11cc432f3cfde9a5

Date: 2017-12-05 15:29:36 +0000

Author: Kipp Cannon <kipp.cannon@ligo.org>

Functions [hide private]
 
extract(connection, filename, table_names=None, verbose=False, xsl_file=None)
Convert the database at the given connection to a tabular LIGO Light-Weight XML document.
source code
 
insert_from_url(url, preserve_ids=False, verbose=False, contenthandler=None)
Parse and insert the LIGO Light Weight document at the URL into the database with which the content handler is associated.
source code
 
insert_from_urls(urls, contenthandler, **kwargs)
Iterate over a sequence of URLs, calling insert_from_url() on each, then build the indexes indicated by the metadata in lsctables.py.
source code
 
insert_from_xmldoc(connection, source_xmldoc, preserve_ids=False, verbose=False)
Insert the tables from an in-ram XML document into the database at the given connection.
source code
 
setup(target, check_same_thread=True) source code
 
update_ids(connection, xmldoc, verbose=False)
For internal use only.
source code
Variables [hide private]
  __package__ = 'glue.ligolw.utils'
Function Details [hide private]

extract(connection, filename, table_names=None, verbose=False, xsl_file=None)

source code 

Convert the database at the given connection to a tabular LIGO Light-Weight XML document. The XML document is written to the file named filename. If table_names is not None, it should be a sequence of strings and only the tables in that sequence will be converted. If verbose is True then progress messages will be printed to stderr.

insert_from_url(url, preserve_ids=False, verbose=False, contenthandler=None)

source code 

Parse and insert the LIGO Light Weight document at the URL into the database with which the content handler is associated. If preserve_ids is False (default), then row IDs are modified during the insert process to prevent collisions with IDs already in the database. If preserve_ids is True then IDs are not modified; this will result in database consistency violations if any of the IDs of newly-inserted rows collide with row IDs already in the database, and is generally only sensible when inserting a document into an empty database. If verbose is True then progress reports will be printed to stderr. See glue.ligolw.dbtables.use_in() for more information about constructing a suitable content handler class.

insert_from_urls(urls, contenthandler, **kwargs)

source code 

Iterate over a sequence of URLs, calling insert_from_url() on each, then build the indexes indicated by the metadata in lsctables.py. See insert_from_url() for a description of the additional arguments.

insert_from_xmldoc(connection, source_xmldoc, preserve_ids=False, verbose=False)

source code 

Insert the tables from an in-ram XML document into the database at the given connection. If preserve_ids is False (default), then row IDs are modified during the insert process to prevent collisions with IDs already in the database. If preserve_ids is True then IDs are not modified; this will result in database consistency violations if any of the IDs of newly-inserted rows collide with row IDs already in the database, and is generally only sensible when inserting a document into an empty database. If verbose is True then progress reports will be printed to stderr.