Connecting to databases using sqlalchemy

Hello guys,

Thanks for this awesome project.

I’m wondering if it’s possible to connect to databases using sqlalchemy or any other way.

Thank you.

You may get a better answer from one of the PyScript team but if you mean connecting to a remote database server then it’s unlikely it can be done in the traditional way, due to the fundamental limitations of the browser and Pyodide (which underpins PyScript).
You could potentially access a local database, but for anything remote, it would not be able to make the usual sorts of network connections that are normally required to communicate in whatever database protocol your database uses

If some kind of web accessible front end is set up to act as an interface to a backend database, then something might be possible but I’m guessing that then wouldn’t be able to operate via sqlalchemy or other traditional tools.

You can get an idea of a few of the general limitations with Pyodide (and thus PyScript) by looking at the FAQ here: Frequently Asked Questions — Version 0.20.0
And also checking out their roadmap (which indicates things that aren’t yet working but that they hope they may resolve with work)

2 Likes

And to clarify my comment about local database, that would be something running locally within the browser under emscripten (so not just locally in the normal sense of being on your local computer)

1 Like

Here’s something along those lines:

1 Like

Thank you! Clarified things here!

1 Like

Greetings to this community.

I’m a bit new to Anaconda Cloud and trying it to analyse my dataset which is stored at my private Postgresql DB (hosted in cloud).

Tried to connect to it via standard sqlalchemy library and got “(psycopg2.OperationalError) could not connect to server: Connection refused” error. Considering the post above (kudos to @neil ) looks like there is no way to do that - has anything changed in that since May 2022?

Obviously this is a bit confusing - what’s the point of Anaconda Cloud if you can’t connect to your data?)))

Hi @artur.yumaev - you should probably post this as its own post rather than tagging on the end of an old one.

Also I suspect you shouldn’t post in the PyScript category if your query is about Anaconda Cloud.

For the avoidance of any confusion PyScript is a specific tool/topic, it’s not a generic reference to scripting in Python :slightly_smiling_face: