# Connecting to databases using sqlalchemy

**URL:** <https://forum.anaconda.com/t/connecting-to-databases-using-sqlalchemy/21298>\
**Category:** PyScript\
**Created:** [May 10, 2022, 5:01pm UTC](https://forum.anaconda.com/t/connecting-to-databases-using-sqlalchemy/21298 "2022-05-10T17:01:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![criarlogins](https://avatars.discourse-cdn.com/v4/letter/c/f5a800/32.png) [@criarlogins](https://forum.anaconda.com/u/criarlogins)\
**Post date:** [May 10, 2022, 5:01pm UTC](https://forum.anaconda.com/t/connecting-to-databases-using-sqlalchemy/21298/1 "2022-05-10T17:01:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![neil](https://dub1.discourse-cdn.com/anaconda/user_avatar/forum.anaconda.com/neil/32/1303_2.png) [@neil](https://forum.anaconda.com/u/neil)\
**Post date:** [May 12, 2022, 10:43pm UTC](https://forum.anaconda.com/t/connecting-to-databases-using-sqlalchemy/21298/2 "2022-05-12T22:43:19Z")

</div>

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](https://pyodide.org/en/stable/usage/faq.html)  
And also checking out their roadmap (which indicates things that aren’t yet working but that they hope they may resolve with work)

---

<div class="post-metadata">

**Author:** ![neil](https://dub1.discourse-cdn.com/anaconda/user_avatar/forum.anaconda.com/neil/32/1303_2.png) [@neil](https://forum.anaconda.com/u/neil)\
**Post date:** [May 12, 2022, 10:45pm UTC](https://forum.anaconda.com/t/connecting-to-databases-using-sqlalchemy/21298/3 "2022-05-12T22:45:35Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![neil](https://dub1.discourse-cdn.com/anaconda/user_avatar/forum.anaconda.com/neil/32/1303_2.png) [@neil](https://forum.anaconda.com/u/neil)\
**Post date:** [May 12, 2022, 10:49pm UTC](https://forum.anaconda.com/t/connecting-to-databases-using-sqlalchemy/21298/4 "2022-05-12T22:49:18Z")

</div>

Here’s something along those lines:

> **[GitHub - sql-js/sql.js: A javascript library to run SQLite on the web.](https://github.com/sql-js/sql.js/)**
>
> A javascript library to run SQLite on the web. . Contribute to sql-js/sql.js development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![criarlogins](https://avatars.discourse-cdn.com/v4/letter/c/f5a800/32.png) [@criarlogins](https://forum.anaconda.com/u/criarlogins)\
**Post date:** [May 13, 2022, 10:53am UTC](https://forum.anaconda.com/t/connecting-to-databases-using-sqlalchemy/21298/5 "2022-05-13T10:53:41Z")

</div>

Thank you! Clarified things here!

---

<div class="post-metadata">

**Author:** ![artur.yumaev](https://avatars.discourse-cdn.com/v4/letter/a/80bc00/32.png) [@artur.yumaev](https://forum.anaconda.com/u/artur.yumaev)\
**Post date:** [October 18, 2023, 8:31am UTC](https://forum.anaconda.com/t/connecting-to-databases-using-sqlalchemy/21298/6 "2023-10-18T08:31:42Z")

</div>

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?)))

---

<div class="post-metadata">

**Author:** ![neil](https://dub1.discourse-cdn.com/anaconda/user_avatar/forum.anaconda.com/neil/32/1303_2.png) [@neil](https://forum.anaconda.com/u/neil)\
**Post date:** [October 18, 2023, 6:22pm UTC](https://forum.anaconda.com/t/connecting-to-databases-using-sqlalchemy/21298/7 "2023-10-18T18:22:37Z")

</div>

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 🙂
