I'm trying to connect to the Suiteanalytics connec...
# suiteanalytics
a
I'm trying to connect to the Suiteanalytics connect ODBC driver with python. Here is the connection string
DRIVER={{{drivername}}};SDSN=<http://NetSuite2.com|NetSuite2.com>;HST={accountid}.<http://connect.api.netsuite.com|connect.api.netsuite.com>;PRT=1708;UID={username};PWD={password}
But I keep getting a TCP/IP connection reset error.
j
Mind sharing the code. I know python documentation for Netsuite is slim to none.
a
message has been deleted
j
Do you need a key or token?
a
It's meant to work with the credentials in the connection string.
I'm pretty sure this is a python issue because it works fine in other applications; I was wondering if anyone here got it working in python.
Those might be of help
m
@Alan Fitch
Copy code
def run_query(self, query: str) -> pd.DataFrame:
    """Warning: I have not figured out how to escape passwords properly, so passwords with semicolon are not supported"""
    logging.debug(f"Running NetSuite ODBC query: {query}")

    dsn = os.environ["NS_ODBC_DSN"]
    username = os.environ["NS_ODBC_USER"]
    password = os.environ["NS_ODBC_PASSWORD"]

    connstring = f"DSN={dsn};UID={username};PWD={password};"
    cnxn = pyodbc.connect(connstring)
    return pd.read_sql(query, cnxn)
e
Curious question, it is a test from your local machine? I mean, is it possible to use the ODBC Driver in the cloud? should we dedicate our own server to achieve this?
m
Should work just fine on a cloud server. For ODBC it might need to be a windows box, but I've set up Linux reporting servers with JDBC connection.
e
Thanks! @michoel