Beispiel #1
0
        """

materialized_view_schema = MaterializedViewSchema(
    local_materialized_view_name="outcomes_mv_hourly_local",
    dist_materialized_view_name="outcomes_mv_hourly_dist",
    prewhere_candidates=["project_id", "org_id"],
    columns=materialized_view_columns,
    query=query,
    local_source_table_name=WRITE_LOCAL_TABLE_NAME,
    local_destination_table_name=READ_LOCAL_TABLE_NAME,
    dist_source_table_name=WRITE_DIST_TABLE_NAME,
    dist_destination_table_name=READ_DIST_TABLE_NAME,
)

raw_storage = WritableTableStorage(
    schemas=StorageSchemas(read_schema=raw_schema, write_schema=raw_schema),
    table_writer=TableWriter(
        write_schema=raw_schema,
        stream_loader=KafkaStreamLoader(
            processor=OutcomesProcessor(),
            default_topic="outcomes",
        ),
    ),
    query_processors=[],
)

materialized_storage = ReadableTableStorage(
    schemas=StorageSchemas(
        read_schema=read_schema,
        write_schema=None,
        intermediary_schemas=[materialized_view_schema],
Beispiel #2
0
schema = ReplacingMergeTreeSchema(
    columns=columns,
    local_table_name="transactions_local",
    dist_table_name="transactions_dist",
    mandatory_conditions=[],
    prewhere_candidates=["event_id", "transaction_name",  "project_id"],
    order_by="(project_id, _finish_date, transaction_name, cityHash64(span_id))",
    partition_by="(retention_days, toMonday(_finish_date))",
    version_column="deleted",
    sample_expr=None,
    migration_function=transactions_migrations,
)

storage = WritableTableStorage(
    schemas=StorageSchemas(read_schema=schema, write_schema=schema),
    table_writer=TransactionsTableWriter(
        write_schema=schema,
        stream_loader=KafkaStreamLoader(
            processor=TransactionsMessageProcessor(), default_topic="events",
        ),
    ),
    query_processors=[
        NestedFieldConditionOptimizer(
            "tags", "_tags_flattened", {"start_ts", "finish_ts"}, BEGINNING_OF_TIME,
        ),
        NestedFieldConditionOptimizer(
            "contexts",
            "_contexts_flattened",
            {"start_ts", "finish_ts"},
            BEGINNING_OF_TIME,
Beispiel #3
0
 def get_schemas(self) -> StorageSchemas:
     return StorageSchemas(
         read_schema=JoinedSchema(self.__structure), write_schema=None
     )