skip to Main Content

Output from psycopg2 differs from command line – Postgresql

When I run select now() - pg_last_xact_replay_timestamp() AS replication_delay directly on the database, the output is replication_delay ------------------- -00:00:00.55072 (1 row) When I put the same query in a python script import psycopg2 try: connection = psycopg2.connect(user="postgres", host="x.x.x.x", port="5432", database="postgres")…

VIEW QUESTION

Parsing nested JSON and collecting data in a list

I am trying to parse a nested JSON and trying to collect data into a list under some condition. Input JSON as below: [ { "name": "Thomas", "place": "USA", "items": [ {"item_name":"This is a book shelf", "level":1}, {"item_name":"Introduction", "level":1}, {"item_name":"parts",…

VIEW QUESTION
Back To Top
Search