Plotting database tables using SQLAlchemy automap, Flask, htmx and Chart.js

Published: 09 September 2021
on channel: Pybites
6,179
110

In this demo / code walkthrough video I will show how to:

Use SQLAlchemy's automap feature to connect to a DB.

Use HTMX to make Ajax calls to various Flask endpoints.

Make a nice line graph using Chart.js

Code repo:
https://github.com/bbelderbos/sa-graph

Mentioned/ related links and tools:
SQLAlchemy's automap feature: https://docs.sqlalchemy.org/en/14/orm...

The graphing code I got thanks to this article: "Graphing Pretty Charts With Python Flask and Chartjs" - https://blog.ruanbekker.com/blog/2017...

You might want to get into htmx, a powerful library that lets you make ajax calls from HTML (no JS code needed!) - https://htmx.org

DB Browser for SQLite: https://sqlitebrowser.org

Mockaroo is a great service / tool for generating fake data: https://www.mockaroo.com

Managing environment variables in Python: https://pybit.es/articles/how-to-hand...

How to run a Flask app: https://flask.palletsprojects.com/en/...

Use Python's zip builtin to transpose a list of tuples (e.g. dict.items()) into a list of x and y values, a handy technique for plotting:   / 1434453201340731395  

----------------------------
There's plenty more to discover with PyBites:

Check out our Python tips book: https://pybit.es/tips

You can also subscribe to receive weekly Python / Career / Mindset tips straight to your inbox here: https://codechalleng.es/tips

To work with us 1:1 to develop that complex project you've always wanted to build, check out our coaching program: https://pybitesdevelopermindset.com/

If you'd prefer to listen to us on the go, we discuss the mindset crucial for a successful developer on our podcast: https://www.pybitespodcast.com/

Visit us at https://pybit.es to find out how we can help you on your Python journey.

Also we'd love to hear what you want more training and content on, just comment below or send us an email at info at pybit.es!


On this page of the site you can watch the video online Plotting database tables using SQLAlchemy automap, Flask, htmx and Chart.js with a duration of hours minute second in good quality, which was uploaded by the user Pybites 09 September 2021, share the link with friends and acquaintances, this video has already been watched 6,179 times on youtube and it was liked by 110 viewers. Enjoy your viewing!