-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlalchemy_scratchpad.py
More file actions
29 lines (20 loc) · 871 Bytes
/
sqlalchemy_scratchpad.py
File metadata and controls
29 lines (20 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import sqlalchemy
eng = sqlalchemy.create_engine('postgresql://stackql:stackql@127.0.0.1:5888/stackql')
## this is the sticking point for now
conn = eng.raw_connection()
curs = conn.cursor()
SHOW_TRANSACTION_ISOLATION_LEVEL = "show transaction isolation level"
SELECT_HSTORE_DETAILS = "SELECT t.oid, typarray FROM pg_type t JOIN pg_namespace ns ON typnamespace = ns.oid WHERE typname = 'hstore'"
SHOW_TRANSACTION_ISOLATION_LEVEL_JSON_EXPECTED = [{"transaction_isolation": "read committed"}]
SELECT_HSTORE_DETAILS_JSON_EXPECTED = []
curs.execute("show transaction isolation level")
# rv = curs.fetchall()
if curs.rowcount > 0:
rv = curs.fetchall() # throws error on empty result set, so this all relies on rowcount being accurate
e1 = None
for entry in rv:
dir(entry)
print(entry)
e1 = entry
else:
print("empty result")