Connecting to a remote db

Hey,
I’m trying to connect to pinotdb using connect(host=url,port=80, path=query/sql, scheme=‘http’)
but it gives error. (produces a “Protocol not available” error.)
Is there any possible way to connect to remote databases?
TIA.

1 Like

Hi @yashshingvi

Welcome to the forum :slightly_smiling_face:

What you’re running into is a common question - there’s a bit more detail in this previous answer i gave to a very similar question here: Connecting to databases using sqlalchemy - #2 by neil

In essence, everything in PyScript is running inside the browser inside the sandbox it imposes, thus you’re unable to run the code successfully because it cannot establish a connection (the sandbox blocks it establishing a socket to your database outside sandbox)

In theory there could be ways to get around this, if you were to construct a web accessible API to your database, because API calls can be made out of the sandbox, but it would need a bit of work.

3 Likes

By the way, most forums generally discourage multiple posts for the same thing, ie this: Introducing, PyScript! ⟨py⟩ - #25 by yashshingvi

That policy applies here too (see guidelines here: FAQ - Anaconda Community )

1 Like

Sorry! Wont happen again.

1 Like