Dev (#3046)
* refactor(chalice): upgraded dependencies * refactor(chalice): changed logging * fix(chalice): fixed CH pagination
This commit is contained in:
parent
f8a40fd875
commit
724d5a2897
4 changed files with 8 additions and 11 deletions
|
|
@ -488,11 +488,10 @@ SELECT *
|
|||
FROM pre_ranked_events;"""
|
||||
logger.debug("---------Q1-----------")
|
||||
ch_query1 = ch.format(query=ch_query1, parameters=params)
|
||||
logger.debug(ch_query1.encode('utf-8'))
|
||||
ch.execute(query=ch_query1)
|
||||
if time() - _now > 2:
|
||||
logger.warning(f">>>>>>>>>PathAnalysis long query EE ({int(time() - _now)}s)<<<<<<<<<")
|
||||
logger.warning(ch_query1.encode('utf-8'))
|
||||
logger.warning(str.encode(ch_query1))
|
||||
logger.warning("----------------------")
|
||||
_now = time()
|
||||
|
||||
|
|
@ -515,11 +514,10 @@ FROM ranked_events
|
|||
{q2_extra_condition if q2_extra_condition else ""};"""
|
||||
logger.debug("---------Q2-----------")
|
||||
ch_query2 = ch.format(query=ch_query2, parameters=params)
|
||||
logger.debug(ch_query2.encode('utf-8'))
|
||||
ch.execute(query=ch_query2)
|
||||
if time() - _now > 2:
|
||||
logger.warning(f">>>>>>>>>PathAnalysis long query EE ({int(time() - _now)}s)<<<<<<<<<")
|
||||
logger.warning(ch_query2.encode('utf-8'))
|
||||
logger.warning(str.encode(ch_query2))
|
||||
logger.warning("----------------------")
|
||||
_now = time()
|
||||
|
||||
|
|
@ -630,11 +628,10 @@ FROM ranked_events
|
|||
ORDER BY event_number_in_session, sessions_count DESC;"""
|
||||
logger.debug("---------Q3-----------")
|
||||
ch_query3 = ch.format(query=ch_query3, parameters=params)
|
||||
logger.debug(ch_query3.encode('utf-8'))
|
||||
rows = ch.execute(query=ch_query3)
|
||||
if time() - _now > 2:
|
||||
logger.warning(f">>>>>>>>>PathAnalysis long query EE ({int(time() - _now)}s)<<<<<<<<<")
|
||||
logger.warning(ch_query3.encode('utf-8'))
|
||||
logger.warning(str.encode(ch_query3))
|
||||
logger.warning("----------------------")
|
||||
|
||||
return __transform_journey(rows=rows, reverse_path=reverse)
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ def search2_table(data: schemas.SessionsSearchPayloadSchema, project_id: int, de
|
|||
{extra_where}
|
||||
GROUP BY {main_col}
|
||||
ORDER BY total DESC
|
||||
LIMIT %(limit_e)s OFFSET %(limit_s)s;"""
|
||||
LIMIT %(limit)s OFFSET %(limit_s)s;"""
|
||||
else:
|
||||
main_query = f"""SELECT COUNT(DISTINCT {main_col}) OVER () AS main_count,
|
||||
{main_col} AS name,
|
||||
|
|
@ -257,13 +257,13 @@ def search2_table(data: schemas.SessionsSearchPayloadSchema, project_id: int, de
|
|||
{extra_where}
|
||||
GROUP BY {main_col}
|
||||
ORDER BY total DESC
|
||||
LIMIT %(limit_e)s OFFSET %(limit_s)s;"""
|
||||
LIMIT %(limit)s OFFSET %(limit_s)s;"""
|
||||
|
||||
main_query = cur.format(query=main_query, parameters=full_args)
|
||||
logging.debug("--------------------")
|
||||
logging.debug(main_query)
|
||||
logging.debug("--------------------")
|
||||
sessions = cur.execute(main_query)
|
||||
sessions = cur.execute(query=main_query)
|
||||
count = 0
|
||||
total = 0
|
||||
if len(sessions) > 0:
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ if config("CH_COMPRESSION", cast=bool, default=True):
|
|||
def transform_result(self, original_function):
|
||||
@wraps(original_function)
|
||||
def wrapper(*args, **kwargs):
|
||||
logger.debug(self.format(query=kwargs.get("query"), parameters=kwargs.get("parameters")))
|
||||
logger.debug(str.encode(self.format(query=kwargs.get("query", ""), parameters=kwargs.get("parameters"))))
|
||||
result = original_function(*args, **kwargs)
|
||||
if isinstance(result, clickhouse_connect.driver.query.QueryResult):
|
||||
column_names = result.column_names
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ requests = "==2.32.3"
|
|||
boto3 = "==1.36.12"
|
||||
pyjwt = "==2.10.1"
|
||||
psycopg2-binary = "==2.9.10"
|
||||
psycopg = {extras = ["binary", "pool"], version = "==3.2.4"}
|
||||
psycopg = {extras = ["pool", "binary"], version = "==3.2.4"}
|
||||
clickhouse-driver = {extras = ["lz4"], version = "==0.2.9"}
|
||||
clickhouse-connect = "==0.8.15"
|
||||
elasticsearch = "==8.17.1"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue