feat(chalice): fixed enum-query interpret
feat(DB): fixed schema
This commit is contained in:
parent
d0b8a53e83
commit
374123b5a2
7 changed files with 19 additions and 14 deletions
|
|
@ -457,7 +457,7 @@ def get_card(metric_id, project_id, user_id, flatten: bool = True, include_data:
|
|||
with pg_client.PostgresClient() as cur:
|
||||
query = cur.mogrify(
|
||||
f"""SELECT metric_id, project_id, user_id, name, is_public, created_at, deleted_at, edited_at, metric_type,
|
||||
view_type, metric_of, metric_value, metric_format, is_pinned, predefined_key, default_config,
|
||||
view_type, metric_of, metric_value, metric_format, is_pinned, default_config,
|
||||
thumbnail, default_config AS config,
|
||||
series, dashboards, owner_email {',data' if include_data else ''}
|
||||
FROM metrics
|
||||
|
|
@ -511,7 +511,7 @@ def get_with_template(metric_id, project_id, user_id, include_dashboard=True):
|
|||
) AS connected_dashboards ON (TRUE)"""
|
||||
query = cur.mogrify(
|
||||
f"""SELECT metric_id, project_id, user_id, name, is_public, created_at, deleted_at, edited_at, metric_type,
|
||||
view_type, metric_of, metric_value, metric_format, is_pinned, predefined_key, default_config,
|
||||
view_type, metric_of, metric_value, metric_format, is_pinned, default_config,
|
||||
thumbnail, default_config AS config,
|
||||
series
|
||||
FROM metrics
|
||||
|
|
|
|||
|
|
@ -858,7 +858,7 @@ def search_query_parts(data: schemas.SessionsSearchPayloadSchema, error_status,
|
|||
apply = True
|
||||
elif f.type == schemas.FetchFilterType._status_code:
|
||||
event_where.append(
|
||||
sh.multi_conditions(f"main.status_code {f.operator} %({e_k_f})s::integer", f.value,
|
||||
sh.multi_conditions(f"main.status_code {f.operator.value} %({e_k_f})s::integer", f.value,
|
||||
value_key=e_k_f))
|
||||
apply = True
|
||||
elif f.type == schemas.FetchFilterType._method:
|
||||
|
|
@ -867,7 +867,7 @@ def search_query_parts(data: schemas.SessionsSearchPayloadSchema, error_status,
|
|||
apply = True
|
||||
elif f.type == schemas.FetchFilterType._duration:
|
||||
event_where.append(
|
||||
sh.multi_conditions(f"main.duration {f.operator} %({e_k_f})s::integer", f.value,
|
||||
sh.multi_conditions(f"main.duration {f.operator.value} %({e_k_f})s::integer", f.value,
|
||||
value_key=e_k_f))
|
||||
apply = True
|
||||
elif f.type == schemas.FetchFilterType._request_body:
|
||||
|
|
|
|||
|
|
@ -482,7 +482,7 @@ def get_card(metric_id, project_id, user_id, flatten=True, include_data: bool =
|
|||
with pg_client.PostgresClient() as cur:
|
||||
query = cur.mogrify(
|
||||
f"""SELECT metric_id, project_id, user_id, name, is_public, created_at, deleted_at, edited_at, metric_type,
|
||||
view_type, metric_of, metric_value, metric_format, is_pinned, predefined_key, default_config,
|
||||
view_type, metric_of, metric_value, metric_format, is_pinned, default_config,
|
||||
thumbnail, DEFAULT_CONFIG AS config,
|
||||
series, dashboards, owner_email {',data' if include_data else ''}
|
||||
FROM metrics
|
||||
|
|
@ -536,7 +536,7 @@ def get_with_template(metric_id, project_id, user_id, include_dashboard=True):
|
|||
) AS connected_dashboards ON (TRUE)"""
|
||||
query = cur.mogrify(
|
||||
f"""SELECT metric_id, project_id, user_id, name, is_public, created_at, deleted_at, edited_at, metric_type,
|
||||
view_type, metric_of, metric_value, metric_format, is_pinned, predefined_key, default_config,
|
||||
view_type, metric_of, metric_value, metric_format, is_pinned, default_config,
|
||||
thumbnail, default_config AS config,
|
||||
series
|
||||
FROM metrics
|
||||
|
|
|
|||
|
|
@ -206,9 +206,9 @@ def search_sessions(data: schemas.SessionsSearchPayloadSchema, project_id, user_
|
|||
ORDER BY s.session_id desc) AS filtred_sessions
|
||||
ORDER BY {sort} {data.order}, issue_score DESC) AS full_sessions;""",
|
||||
full_args)
|
||||
print("--------------------")
|
||||
print(main_query)
|
||||
print("--------------------")
|
||||
# print("--------------------")
|
||||
# print(main_query)
|
||||
# print("--------------------")
|
||||
try:
|
||||
cur.execute(main_query)
|
||||
except Exception as err:
|
||||
|
|
@ -860,7 +860,7 @@ def search_query_parts(data: schemas.SessionsSearchPayloadSchema, error_status,
|
|||
apply = True
|
||||
elif f.type == schemas.FetchFilterType._status_code:
|
||||
event_where.append(
|
||||
sh.multi_conditions(f"main.status_code {f.operator} %({e_k_f})s::integer", f.value,
|
||||
sh.multi_conditions(f"main.status_code {f.operator.value} %({e_k_f})s::integer", f.value,
|
||||
value_key=e_k_f))
|
||||
apply = True
|
||||
elif f.type == schemas.FetchFilterType._method:
|
||||
|
|
@ -869,7 +869,7 @@ def search_query_parts(data: schemas.SessionsSearchPayloadSchema, error_status,
|
|||
apply = True
|
||||
elif f.type == schemas.FetchFilterType._duration:
|
||||
event_where.append(
|
||||
sh.multi_conditions(f"main.duration {f.operator} %({e_k_f})s::integer", f.value,
|
||||
sh.multi_conditions(f"main.duration {f.operator.value} %({e_k_f})s::integer", f.value,
|
||||
value_key=e_k_f))
|
||||
apply = True
|
||||
elif f.type == schemas.FetchFilterType._request_body:
|
||||
|
|
|
|||
|
|
@ -1064,7 +1064,7 @@ def search_query_parts_ch(data: schemas.SessionsSearchPayloadSchema, error_statu
|
|||
apply = True
|
||||
elif f.type == schemas.FetchFilterType._status_code:
|
||||
event_where.append(
|
||||
_multiple_conditions(f"main.status {f.operator} %({e_k_f})s", f.value,
|
||||
_multiple_conditions(f"main.status {f.operator.value} %({e_k_f})s", f.value,
|
||||
value_key=e_k_f))
|
||||
events_conditions[-1]["condition"].append(event_where[-1])
|
||||
apply = True
|
||||
|
|
@ -1075,7 +1075,7 @@ def search_query_parts_ch(data: schemas.SessionsSearchPayloadSchema, error_statu
|
|||
apply = True
|
||||
elif f.type == schemas.FetchFilterType._duration:
|
||||
event_where.append(
|
||||
_multiple_conditions(f"main.duration {f.operator} %({e_k_f})s", f.value, value_key=e_k_f))
|
||||
_multiple_conditions(f"main.duration {f.operator.value} %({e_k_f})s", f.value, value_key=e_k_f))
|
||||
events_conditions[-1]["condition"].append(event_where[-1])
|
||||
apply = True
|
||||
elif f.type == schemas.FetchFilterType._request_body:
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ $$
|
|||
ALTER TABLE IF EXISTS metrics
|
||||
DROP COLUMN IF EXISTS active,
|
||||
DROP COLUMN IF EXISTS is_predefined,
|
||||
DROP COLUMN IF EXISTS predefined_key,
|
||||
DROP COLUMN IF EXISTS is_template,
|
||||
DROP COLUMN IF EXISTS category,
|
||||
DROP COLUMN IF EXISTS o_metric_id,
|
||||
|
|
@ -132,6 +133,7 @@ DROP INDEX IF EXISTS public.sessions_user_browser_gin_idx;
|
|||
DROP INDEX IF EXISTS public.sessions_user_os_gin_idx;
|
||||
DROP INDEX IF EXISTS public.issues_context_string_gin_idx;
|
||||
|
||||
|
||||
ALTER TABLE IF EXISTS projects
|
||||
ADD COLUMN IF NOT EXISTS beacon_size integer NOT NULL DEFAULT 0;
|
||||
|
||||
|
|
@ -324,7 +326,6 @@ $$
|
|||
$$
|
||||
LANGUAGE plpgsql;
|
||||
|
||||
|
||||
DROP FUNCTION get_new_filter_key;
|
||||
DROP FUNCTION get_new_event_filter_key;
|
||||
DROP FUNCTION get_new_event_key;
|
||||
|
|
|
|||
|
|
@ -300,6 +300,10 @@ $$
|
|||
$$
|
||||
LANGUAGE plpgsql;
|
||||
|
||||
DROP FUNCTION get_new_filter_key;
|
||||
DROP FUNCTION get_new_event_filter_key;
|
||||
DROP FUNCTION get_new_event_key;
|
||||
|
||||
DROP TABLE IF EXISTS public.funnels;
|
||||
ALTER TABLE IF EXISTS public.metrics
|
||||
ADD COLUMN IF NOT EXISTS data jsonb NULL;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue