Пример #1
0
    def store_raw(self, datasource, rawdatapackage):
        with closing(self.conn.cursor()) as cursor:
            datapackage = rawdatapackage.refine(cursor)

            dn = rawdatapackage.rows[0][0]
            entity = get_entity(cursor, dn)
            entitytype = get_entitytype_by_id(cursor, entity.entitytype_id)

        self.store(datasource, entitytype, datapackage)
Пример #2
0
    def execute(self, cursor, state):
        entity = get_entity(cursor, self.dn)
        entitytype = get_entitytype_by_id(cursor, entity.entitytype_id)
        datapackage = state["datapackage"]

        trendstore = TrendStore.get(cursor, self.datasource, entitytype,
                datapackage.granularity)

        if not trendstore:
            partition_size = 86400

            trendstore = TrendStore(self.datasource, entitytype,
                    datapackage.granularity, partition_size, "table").create(cursor)

        partition = trendstore.partition(datapackage.timestamp)

        logging.debug(partition.name)

        state["partition"] = partition
Пример #3
0
def get_or_create_entity(cursor, dn):
    value = get_entity(cursor, dn)

    if_none = partial(create_entity, cursor, dn)

    return none_or(if_none, identity)(value)