def main(): options = docopt.docopt(__doc__) name_or_ids = [s.decode('UTF8') for s in options['<name_or_id>']] stream = options['stream'] engine = create_engine_from_url(None) session = create_scoped_session(engine) MetadataBase.query = session.query_property() if stream: streams = get_objects_from_preload(Stream, name_or_ids) list_stream_parameters(name_or_ids, streams) else: parameters = get_objects_from_preload(Parameter, name_or_ids) list_parameters(name_or_ids, parameters)
#!/usr/bin/env python import yaml from ooi_data.postgres.model import * from tools.m2m import MachineToMachine from database import create_engine_from_url, create_scoped_session engine = create_engine_from_url(None) session = create_scoped_session(engine) MetadataBase.query = session.query_property() def build_dpi_map(): """ Build a map from a specific data product identifier to a set of parameters which fulfill it :return: """ dpi_map = {} for p in Parameter.query: if p.data_product_identifier: dpi_map.setdefault(p.data_product_identifier, set()).add(p) return dpi_map def build_affects_map(): """ Build a map from parameter to the set of parameters *directly* affected by it :return: """
#!/usr/bin/env python import codecs import os import shutil import logging import jinja2 import database import numpy as np from ooi_data.postgres.model import Stream engine = database.create_engine_from_url(None) Session = database.create_scoped_session(engine) session = Session() DROP_KEYSPACE = 'drop keyspace ooi;\n\n' CREATE_KEYSPACE = "create keyspace ooi with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };\n\n" CREATE_PROVENANCE = ''' CREATE TABLE ooi.dataset_l0_provenance ( subsite text, node text, sensor text, method text, deployment int, id uuid, fileName text, parserName text,
#!/usr/bin/env python import codecs import os import shutil import logging import jinja2 import database import numpy as np from ooi_data.postgres.model import Stream engine = database.create_engine_from_url(None) Session = database.create_scoped_session(engine) session = Session() DROP_KEYSPACE = 'drop keyspace ooi;\n\n' CREATE_KEYSPACE = "create keyspace ooi with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };\n\n" CREATE_PROVENANCE = ''' CREATE TABLE ooi.dataset_l0_provenance ( subsite text, node text, sensor text, method text, deployment int, id uuid, fileName text, parserName text, parserVersion text, PRIMARY KEY((subsite, node, sensor), method, deployment, id)
def setUpClass(cls): engine = create_engine_from_url(None) session = create_scoped_session(engine) MetadataBase.query = session.query_property()