コード例 #1
0
 def backwards_dist(self) -> Sequence[operations.Operation]:
     return [
         operations.DropTable(storage_set=StorageSetKey.EVENTS,
                              table_name="sentry_dist"),
         operations.DropTable(storage_set=StorageSetKey.EVENTS_RO,
                              table_name="sentry_dist_ro"),
     ]
コード例 #2
0
ファイル: 0001_sessions.py プロジェクト: fpacifici/snuba
 def backwards_dist(self) -> Sequence[operations.Operation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.SESSIONS, table_name="sessions_hourly_dist",
         ),
         operations.DropTable(
             storage_set=StorageSetKey.SESSIONS, table_name="sessions_raw_dist",
         ),
     ]
コード例 #3
0
ファイル: 0001_outcomes.py プロジェクト: fpacifici/snuba
 def backwards_dist(self) -> Sequence[operations.Operation]:
     return [
         operations.DropTable(storage_set=StorageSetKey.OUTCOMES,
                              table_name="outcomes_hourly_local"),
         operations.DropTable(
             storage_set=StorageSetKey.OUTCOMES,
             table_name="outcomes_raw_dist",
         ),
     ]
コード例 #4
0
 def backwards_local(self) -> Sequence[operations.Operation]:
     # Drop the temporary tables used by forwards_local if they exist
     return [
         operations.DropTable(
             storage_set=StorageSetKey.EVENTS, table_name=TABLE_NAME_NEW,
         ),
         operations.DropTable(
             storage_set=StorageSetKey.EVENTS, table_name=TABLE_NAME_OLD,
         ),
     ]
コード例 #5
0
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.SESSIONS,
             table_name="sessions_hourly_mv_local",
         ),
         operations.DropTable(
             storage_set=StorageSetKey.SESSIONS,
             table_name="sessions_hourly_local",
         ),
         operations.DropTable(
             storage_set=StorageSetKey.SESSIONS,
             table_name="sessions_raw_local",
         ),
     ]
コード例 #6
0
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.CDC,
             table_name="groupedmessage_local",
         )
     ]
コード例 #7
0
 def backwards_local(self) -> Sequence[operations.Operation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.TRANSACTIONS,
             table_name="spans_experimental_local",
         ),
     ]
コード例 #8
0
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.METRICS,
             table_name=get_consolidated_mv_name("sets"),
         )
     ]
コード例 #9
0
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.METRICS,
             table_name=get_polymorphic_mv_name(mv_type),
         ) for mv_type in ["sets", "counters", "distributions"]
     ]
コード例 #10
0
ファイル: 0001_profiles.py プロジェクト: getsentry/snuba
 def backwards_dist(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.PROFILES,
             table_name="profiles_dist",
         )
     ]
コード例 #11
0
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.REPLAYS,
             table_name="replays_local",
         ),
     ]
コード例 #12
0
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.METRICS,
             table_name=get_polymorphic_mv_v3_name("counters"),
         )
     ]
コード例 #13
0
 def forwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(storage_set=StorageSetKey.METRICS,
                              table_name=table_name)
         for table_name in [
             "metrics_counters_consolidated_mv_local",
             "metrics_counters_mv_10s_local",
             "metrics_counters_mv_3600s_local",
             "metrics_counters_mv_86400s_local",
             "metrics_counters_mv_local",
             "metrics_counters_polymorphic_mv_local",
             "metrics_counters_polymorphic_mv_v2_local",
             "metrics_counters_polymorphic_mv_v3_local",
             "metrics_distributions_consolidated_mv_local",
             "metrics_distributions_mv_10s_local",
             "metrics_distributions_mv_3600s_local",
             "metrics_distributions_mv_86400s_local",
             "metrics_distributions_mv_local",
             "metrics_distributions_polymorphic_mv_local",
             "metrics_distributions_polymorphic_mv_v2_local",
             "metrics_distributions_polymorphic_mv_v3_local",
             "metrics_sets_consolidated_mv_local",
             "metrics_sets_mv_10s_local",
             "metrics_sets_mv_3600s_local",
             "metrics_sets_mv_86400s_local",
             "metrics_sets_mv_local",
             "metrics_sets_polymorphic_mv_local",
             "metrics_sets_polymorphic_mv_v2_local",
             "metrics_sets_polymorphic_mv_v3_local",
         ]
     ]
コード例 #14
0
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.DISCOVER,
             table_name="discover_local",
         )
     ]
コード例 #15
0
 def backwards_dist(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.CDC,
             table_name="groupassignee_dist",
         )
     ]
コード例 #16
0
 def backwards_local(self) -> Sequence[operations.Operation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.EVENTS,
             table_name="groupassignee_local",
         )
     ]
コード例 #17
0
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.EVENTS,
             table_name="errors_local",
         )
     ]
コード例 #18
0
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.TRANSACTIONS,
             table_name="transactions_local",
         )
     ]
コード例 #19
0
ファイル: 0001_migrations.py プロジェクト: getsentry/snuba
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.MIGRATIONS,
             table_name="migrations_local",
         )
     ]
コード例 #20
0
 def backwards_dist(self) -> Sequence[operations.Operation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.EVENTS,
             table_name="groupedmessage_dist",
         )
     ]
コード例 #21
0
 def backwards_dist(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.GENERIC_METRICS_SETS,
             table_name="generic_metric_sets_aggregated_dist",
         )
     ]
コード例 #22
0
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.METRICS,
             table_name=get_mv_name("distributions", granularity=10),
         )
     ]
コード例 #23
0
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.OUTCOMES,
             table_name="outcomes_mv_hourly_local",
         ),
         operations.CreateMaterializedView(
             storage_set=StorageSetKey.OUTCOMES,
             view_name="outcomes_mv_hourly_local",
             destination_table_name="outcomes_hourly_local",
             columns=old_materialized_view_columns,
             query="""
                 SELECT
                     org_id,
                     project_id,
                     ifNull(key_id, 0) AS key_id,
                     toStartOfHour(timestamp) AS timestamp,
                     outcome,
                     ifNull(reason, 'none') AS reason,
                     count() AS times_seen
                 FROM outcomes_raw_local
                 GROUP BY org_id, project_id, key_id, timestamp, outcome, reason
             """,
         ),
     ]
コード例 #24
0
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.GENERIC_METRICS_SETS,
             table_name=self.local_table_name,
         )
     ]
コード例 #25
0
ファイル: 0001_querylog.py プロジェクト: cafebazaar/snuba
 def backwards_dist(self) -> Sequence[operations.Operation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.QUERYLOG,
             table_name="querylog_dist",
         )
     ]
コード例 #26
0
def ensure_drop_temporary_tables() -> None:
    cluster = get_cluster(StorageSetKey.EVENTS)

    if not cluster.is_single_node():
        return

    clickhouse = cluster.get_query_connection(ClickhouseClientSettings.MIGRATE)
    clickhouse.execute(
        operations.DropTable(
            storage_set=StorageSetKey.EVENTS,
            table_name=TABLE_NAME_NEW,
        ).format_sql())
    clickhouse.execute(
        operations.DropTable(
            storage_set=StorageSetKey.EVENTS,
            table_name=TABLE_NAME_OLD,
        ).format_sql())
コード例 #27
0
 def backwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.METRICS,
             table_name=get_polymorphic_mv_variant_name(
                 "sets", self.mv_version),
         )
     ]
コード例 #28
0
ファイル: templates.py プロジェクト: getsentry/snuba
def get_reverse_table_migration(
        table_name: str) -> Sequence[operations.SqlOperation]:
    return [
        operations.DropTable(
            storage_set=StorageSetKey.METRICS,
            table_name=table_name,
        ),
    ]
コード例 #29
0
 def backwards_local(self) -> Sequence[operations.Operation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.SESSIONS,
             table_name="sessions_hourly_mv_local",
         ),
         create_matview_v1,
     ]
コード例 #30
0
 def forwards_local(self) -> Sequence[operations.SqlOperation]:
     return [
         operations.DropTable(
             storage_set=StorageSetKey.METRICS,
             table_name=get_polymorphic_mv_variant_name(
                 "distributions", self.mv_version),
         ),
         get_forward_view_migration_polymorphic_table_v3(
             source_table_name=self.raw_table_name,
             table_name=self.dist_table_name,
             aggregation_col_schema=COL_SCHEMA_DISTRIBUTIONS_V2,
             mv_name=get_polymorphic_mv_variant_name(
                 "distributions", self.mv_version),
             aggregation_states=
             ("quantilesState(0.5, 0.75, 0.9, 0.95, 0.99)((arrayJoin(distribution_values) AS values_rows)) as percentiles, "
              "minState(values_rows) as min, "
              "maxState(values_rows) as max, "
              "avgState(values_rows) as avg, "
              "sumState(values_rows) as sum, "
              "countState(values_rows) as count, "
              "histogramState(250)(values_rows) as histogram_buckets"),
             metric_type="distribution",
             target_mat_version=4,
         ),
         operations.DropTable(
             storage_set=StorageSetKey.METRICS,
             table_name=get_polymorphic_mv_variant_name(
                 "sets", self.mv_version),
         ),
         get_forward_view_migration_polymorphic_table_v3(
             source_table_name=self.raw_table_name,
             table_name=self.sets_table_name,
             aggregation_col_schema=[
                 Column("value",
                        AggregateFunction("uniqCombined64", [UInt(64)])),
             ],
             aggregation_states=
             "uniqCombined64State(arrayJoin(set_values)) as value",
             mv_name=get_polymorphic_mv_variant_name(
                 "sets", self.mv_version),
             metric_type="set",
             target_mat_version=4,
         ),
     ]