Trouble creating query in pytigergraph

Hello Tigergraph community,
I am having trouble creating queries in pytigergraph. I am able to connect to Tigergraph cloud.
Here is my code:

print(conn.gsql(’’’

USE GRAPH Alumni
CREATE OR REPLACE QUERY User(vertex p) for GRAPH Alumni {
seed = {p};
result1 = SELECT u FROM seed:u;
PRINT result1;
}
‘’’, options=[]))

I am getting error 212:

ERROR:root:An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: (‘EOF in multi-line string’, (1, 0))

Any help would be greatly appreciated. Thank you

Hi @digitalpaddyo! Welcome to the community!

Can you confirm that you have your connection variables are set up? Here is an example:

# SETUP TIGERGRAPH CONNECTION
conn = tg.TigerGraphConnection(host="https://my-box.i.tgcloud.io", username="tigergraph", password="tigergraph")

# FETCH TOKEN
conn.apiToken = conn.getToken("klwjEIO38IY89HIUE7G9D8H8OSD") 

Next, test to see if you can access your box via the LS command.

# TEST TO SEE IF GRAPH SCHEMA BUILT
print(conn.gsql('''LS''', options=[]))

Let me know if that is successful. Thanks!

Hello Jon, thank you for your response. I was able to do what you said and connect to my graph but I can’t create the query. Could I please send you my notebook? Thanks

@digitalpaddyo just sent you an email. Also removed your email from the last post (would hate for a bot to pull your email to start spamming you). If you click on a username you can directly send a message to someone in the community.

Looks like the error 212 was caused by the GPE service down. When service was started, code ran nominally.

1 Like