Skip to content

Commit 5e66ed1

Browse files
committed
updated readme
1 parent 9a5d735 commit 5e66ed1

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

README.md

+27-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ A few examples of the most common functionalities provided by the adapter:
3535
import polypheny
3636

3737
# Connect to Polypheny
38-
connection = polypheny.connect('localhost', 20590, username='pa', password='')
38+
connection = polypheny.connect('127.0.0.1', 20590, username='pa', password='', transport='plain')
39+
40+
# If Python 3.8 is used the connection needs to bespecified as a tuple. Uncomment the following line
41+
#connection = polypheny.connect(('127.0.0.1', 20590), username='pa', password='', transport='plain')
3942

4043
# Get a cursor
4144
cursor = connection.cursor()
@@ -50,9 +53,30 @@ connection.commit()
5053
# Execute a query
5154
cursor.execute("SELECT * from dummy")
5255

56+
print("\nRelational output from SQL")
57+
print("\t",cursor.fetchone())
58+
59+
# Accessing data using MQL
60+
cursor.executeany('mongo', 'db.dummy.find()',namespace='public')
61+
62+
return_mql = cursor.fetchone()
63+
#json_output = json.loads( return_mql )
64+
65+
66+
print("\nPlain JSON output from MQL")
67+
print("\t",return_mql)
68+
69+
70+
71+
print("\nPlain JSON key 'text' from from MQL return")
72+
print("\t",return_mql["text"])
73+
74+
75+
cursor.execute("DROP TABLE dummy")
76+
5377
# Print result
54-
for f in cursor:
55-
print(f)
78+
#for f in cursor:
79+
# print(f)
5680

5781
# Close the connection
5882
connection.close()

0 commit comments

Comments
 (0)