Solved INSERT query issue
This commit is contained in:
parent
8636fd45db
commit
72d8aa42c3
1 changed files with 2 additions and 1 deletions
|
|
@ -8,11 +8,12 @@ from chalicelib.utils import pg_client
|
|||
|
||||
def handle_frontend_signals(project_id: int, user_id: str, data: schemas_ee.SignalsSchema):
|
||||
res = {'errors': 'query not executed'}
|
||||
insights_query = """INSERT INTO public.frontend_signals VALUES (%(project_id)s, %(user_id)s, %(timestamp)s, %(action)s, %(source)s, %(category)s, %(data)s)"""
|
||||
insights_query = """INSERT INTO public.frontend_signals (project_id, user_id, timestamp, action, source, category, data) VALUES (%(project_id)s, %(user_id)s, %(timestamp)s, %(action)s, %(source)s, %(category)s, %(data)s)"""
|
||||
try:
|
||||
with pg_client.PostgresClient() as conn:
|
||||
query = conn.mogrify(insights_query, {'project_id': project_id, 'user_id': user_id, 'timestamp': data.timestamp, 'action': data.action, 'source': data.source,
|
||||
'category': data.category, 'data': json.dumps(data.data)})
|
||||
logging.info(f'QUERY: {query}')
|
||||
conn.execute(query)
|
||||
# res = helper.dict_to_camel_case(conn.fetchone())
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue