Parse Values from Insert Statement

97 views
Skip to first unread message

yoav moon

unread,
Dec 3, 2016, 9:44:33 AM12/3/16
to sqlparse
Hi, 

I need to extract one of the values from a bunch of insert statements.
I don't have all the existing queries in advance so I need something generic that will be able to extract the cusotmer_id
from each of the statements.

Here is an example:

INSERT INTO object (id, updated_on, type, status, priority, extra, table_pk, customer_id, owner_id) 
VALUES (3586, '2016-12-02T21:50:48.460497'::timestamp, 'NEW', 'HIGH', 1, hstore(ARRAY['name'], ARRAY['[`this] 2016-10-28T13:30:04.474115']), 14, 3, 5) RETURNING id


Is there a way to get the value using sqlparse?

Thanks,
Yoav
Reply all
Reply to author
Forward
0 new messages