I am an absolute beginner in TigerGraph, and I'm following this tutorial to get familiar with it. In the part of this tutorial where a Python script is used to connect to the TigerGraph solution and create a schema, I am getting a "connection refused" error.
The code:
# Imports
import pyTigerGraph as tg
import json
import pandas as pd
# Connection parameters
hostName = "https://DOMAIN.i.tgcloud.io"
userName = "tigergraph"
password = "XXXXXX"
conn = tg.TigerGraphConnection(host=hostName, username=userName, password=password)
print("Connected")
The print("connected")
statement executes, and I am able to see "connected" printed in the output
The next part of the code is where the error occurs:
# DEFINE / CREATE ALL EDGES AND VERTICES
results = conn.gsql('''
USE GLOBAL
CREATE VERTEX Person (PRIMARY_ID id STRING, name STRING, email STRING, username STRING, created_at DATETIME) WITH primary_id_as_attribute="true"
CREATE VERTEX Post (PRIMARY_ID id STRING, content STRING, posted_date DATETIME, deleted BOOL) WITH primary_id_as_attribute="true"
CREATE VERTEX Hashtag (PRIMARY_ID tag STRING) WITH primary_id_as_attribute="true"
CREATE VERTEX Message (PRIMARY_ID id STRING, subject STRING, body STRING) WITH primary_id_as_attribute="true"
CREATE DIRECTED EDGE posted (From Person, To Post, post_date DATETIME) WITH REVERSE_EDGE="reverse_posted"
CREATE DIRECTED EDGE liked (From Person, To Post, like_date DATETIME) WITH REVERSE_EDGE="reverse_liked"
CREATE DIRECTED EDGE has_tag (From Post, To Hashtag) WITH REVERSE_EDGE="reverse_has_tag"
CREATE DIRECTED EDGE sent_message (From Person, To Message, to_person STRING, sent_date DATETIME) WITH REVERSE_EDGE="reverse_sent_message"
CREATE DIRECTED EDGE received_message (From Message, To Person, from_person STRING, receive_date DATETIME, opened_date DATETIME) WITH REVERSE_EDGE="reverse_received_message"
''')
print(results)
The error I am getting:
Connection failed. Check your username or password [Errno 111] Connection refused Couldn't initialize the client. See above error. An exception has occurred, use %tb to see the full traceback
I checked the username and password, and they are correct. What is causing this problem and how do I fix this?
The Google Colab notebook provided by the tutorial makers from which I have posted the code snippets can be found here
pyTigerGraph version: 0.9.1
Can you add tgCloud=True
to your parameter settings?
Example:
conn = tg.TigerGraphConnection(host=hostName, username=userName, password=password, tgCloud=True)
With the latest release of TigerGraph Cloud ports were changed to route through 443. I've been informed logic checking is coming to pyTigeGraph soon that will automatically apply the tgCloud parameter if needed.
I've created a Sample Notebook that you can use as a test. https://colab.research.google.com/drive/1U6REqBiMqUGtgolRtlbbLmPf-EkCGhvl?usp=sharing