Using postgreSQL database as datasource

Hi all,
does anybody know if their is any guidline for using a database like postgreSQL as a source for holoviews? I took a look at this https://holoviews.org/user_guide/Tabular_Datasets.html basic document but beside this I didn’t find anything.
Does anyone has experiences in this field and is willing to share these?

1 Like

There is no plug and play for sql database. I already thought that it could be a good idea to autogenerate a dashboard by exploring a database structure.

You can check the second part of my article, it’s dealing with plotting data from a postgresql database with holoviews IoT measurements data

1 Like

I like to use pd.read_sql() and then holoviews/hvplot immediately can support it.

If you are only reading then Pandas’ built in is probably the easiest approach as @ahuang11 suggested.

If you want to insert/write/etc as well then https://www.psycopg.org/ is an option.

If, you’re at the stage of considering options for a Panel front end + database, then I strongly recommend you to explore https://anvil.works/. Their built-in Data Tables and also their Anvil-Uplink solutions combined with Panel apps are absolutely amazing.

The latency you can achieve with a Anvil + Panel + Heroku for free is crazy…

Hi @danmaty

Do you have a link to a example combining Anvil+Panel? I would like to learn how they can be combined and experience the low latency mentioned. Thanks.

1 Like

HoloViews has an as-yet-minimally-documented SQL backend via Ibis nowadays: https://github.com/holoviz/holoviews/pull/4517

1 Like

Thanks @jbednar .

Is there any example or docs that can be found? Where?

@philippjfr 's last comment on that PR was “I’m merging now and hoping that we can get some docs in before release”, but I don’t recall docs or examples ever appearing. @philippjfr?

@sophiamyang I’m tagging you here, in case that you are looking for a topic to write one of those AWSOME/life-saver articles. Big fan!

1 Like

Just saw this. Thanks so much :pray:

1 Like

I have been working on a project that pulls data from a MySQL database (but PostgreSQL shouldn’t be too different). In your development environment make sure you have the proper drivers/packages installed. Since I was running with MySQL I opted to connect and query with SQLAlchemy, process and cache the results via Panel’s low-level cache.

From there I just load from the cache whenever I want to render a visualization.

1 Like