HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
pallets-eco
flask-sqlalchemy
Python2014–2017
pallets-eco / flask-sqlalchemy

flask-sqlalchemy

Adds SQLAlchemy support to Flask

4Distinct people
4Mentions
0Explicit recommenders
4.3KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Adds SQLAlchemy support to Flask

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 11:56:56 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year4 dated mentions

Observed mentions: 2014-07-03 14:35:04 UTC to 2017-07-04 09:27:19 UTC.

0122014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20142015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2017

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC101
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC101
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC000
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC202

What Hacker News says

4 sources
Extensions can register themselves with the Flask application object, so you can look there: current_app.extensions['whatever']. However, it is not specified what exactly this dictionary contains, so eg. SQLAlchemy puts a custom State class there. You can still get the extension object out of it, it's just that there is no common convention. http://flask.pocoo.org/docs/0.12/api/#flask.Flask.extensions https://github.com/mitsuhiko/flask-sqlalchemy/blob/master/fl...
In Django vs. Flask
You can get pretty far with Flask. You'll need an ORM, so you'll likely chuck SQLAlchemy in. Then you'll want easier access to SQLAlchemy, sorta like, you know, django does it, so you pick up https://github.com/mitsuhiko/flask-sqlalchemy. But you can't use pure SQLAlchemy models (easily), since this otherwise great extension for flask doesn't support it (https://github.com/mitsuhiko/flask-sqlalchemy/pull/250, yes I'm in the thread). You'll fork it or brew your own code to get declarative models working right. Kinda time consuming, but at least your models can be pulled in by any python code, and aren't tied down to a framework (That's what you were avoiding from the first place, wasn't it?) Then you'll pick up WTForms (https://wtforms.readthedocs.io/en/latest/), another excellent library. And you'll miss having Django ORM's rich form and
Read the rest
model-backed validation. So you'll try wtforms-alchemy, https://github.com/kvesteri/wtforms-alchemy. Then you'll begin to see why Django makes sense after using Flask for a while. Django pulls in all the essential stuff and supports it well. And top of that, django's addons like django-extensions (https://django-extensions.readthedocs.io), which gives you Werkzeug's debugger if you use ./manage.py runserver_plus. And ./manage.py shell_plus, which integrates with ptpython/ipython/bpython (https://django-extensions.readthedocs.io/en/latest/shell_plu...). Django rest framework, DRF for short (http://www.django-rest-framework.org/), which is very mature at this stage, runs circles around Flask API. Flask API is inspired by DRF. You could also try https://flask-restful.readthedocs.io, but after all that, you'll be missing that tight model support. You'll love flask. The code is top tier and exemplary. The testsuites are a dream and are very clear. Documentation is awesome. It feels good to code in it. But django feels good to code in as well. Django's ORM is very mature. It's easier than SQLAlchemy, and despite SQLAlchemy's purity, and documentation - even better than flask's - Django's ORM does the trick for pretty much anything, even foreign databases I've interacted with. Another thing, QuerySet's are a charm, a lot of django's addons like django-filters, django-rest-framework and django-tables2 are built on top of its versatility. Another thing Flask community ends up having to clone from Django is django-debug-toolbar https://github.com/django-debug-toolbar/django-debug-toolbar. See https://flask-debugtoolbar.readthedocs.io. Again, I love flask, but when I realized that I'm just going to end up reinventing django with my flask app anyway, I started going with django on new projects. I haven't turned back, but still check out flask and sqlalchemy to see what's happening now and then.
In Ask HN: Django vs. Flask
Cool, thanks for the thoughts. I'm going to go with Flask: my 24-hours-in opinion is that I can work with this, and it's got enough community support to make the easy things easy. I haven't done logins or much more with sqlalchemy-flask, but they seem good. I'm a little worried the flask plugins are thin. As with anything where you have lots of flexibility, you can stub your toes if you don't know the "right" way to do it. For example, I tried to use flask-assets and pyscss to compile sass, but I found a bug in pyscss pretty quickly and had to back out and switch to the Ruby implementation of sass. Not ultimately a big deal, and the whole thing was up and running in about 3 hours. EDIT: Ugh, more pain with Flask plugins. Flask-SQLAlchemy assumes you're going to declare models that won't be used outside of the web context ... so you can't
Read the rest
separate your models from Flask. Annoying! Getting fixed here: https://github.com/mitsuhiko/flask-sqlalchemy/pull/250 So, anyway, that's what I'm going to do! Thanks for all your input!
In Ask HN: What's the state of Python web frameworks in 2015?
This is a very welcome development in the Flask world. It seems that Armin Ronacher (mitsuhiko) found himself in a situation where things outside of open-source projects started demanding more of his time [0] while issues and PRs started accumulating on Flask, Flask-SQLAlchemy etc. You can't really blame him for being overwhelmed by it, and thankfully, in the past day some progress has been made [1] and maintainers are being selected. [0]: http://lucumr.pocoo.org/2013/11/28/emotional-programming/ [1]: https://github.com/mitsuhiko/flask-sqlalchemy/issues/197#iss...
In Metaflask - A repository to organize the Flask ecosystem

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.