'Empty output using trino dbapi in python
I am getting empty output in the below code but when I remove the part of and
I get the desired output. Can anyone clarify if there is any error in syntax of below part:
and json_extract_scalar(events.properties,'$.methods.ggg') = json_extract_scalar('{"enabled":"*Old*: 0\n*New*: 1"}', '$.enabled')
Code:
import trino
import pandas as pd
conn = trino.dbapi.connect(
host='trino-scheduler-coordinator-int.de.domain.com',
port=000,
user='[email protected]',
catalog='xyz',
schema = 'abc',
http_scheme='https',
)
cur = conn.cursor()
cur.execute("""select json_extract_scalar (events.properties,'$.merchant.id')
from xyz.abc.events
where producer_created_date > date_format(CURRENT_DATE - interval '35' day,'%Y-%m-%d')
and json_extract_scalar(events.properties,'$.methods.ggg') = json_extract_scalar('{"enabled":"*Old*: 0\n*New*: 1"}', '$.enabled')
limit 10""")
temp = cur.fetchall()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|