-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a connector for SQLAlchemy with Psycopg2 #453
Conversation
0bb0f7b
to
b94c893
Compare
e75674b
to
e38bbaa
Compare
@@ -0,0 +1,176 @@ | |||
import functools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in contrib ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, could be. I have no problem with moving it to the contrib folder. But do we agree that it's just a folder change, and that contribs have nothing else specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the connector to the contrib.sqlalchemy
module.
django = {version = ">=2.2", optional = true} | ||
sqlalchemy = {version = "^1.4", optional = true} | ||
|
||
[tool.poetry.extras] | ||
django = ["django"] | ||
sqlalchemy = ["sqlalchemy"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woo, new syntax ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the previous syntax did not work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proof is that we didn't have to use poetry install --extras django
in the CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh. Damn :/
d9dd35b
to
0d0f407
Compare
@ewjoachim, we get the following in the codecov report, and I don't know what to do to fix the problem:
Do you know what we can do about it? |
96599e3
to
5fd82dc
Compare
5fd82dc
to
8d7bc54
Compare
Coverage reportThe coverage rate went from The branch rate is
|
This is ready for review again. |
Woops :D I'll have to fix that in the github action :D |
sqlalchemy>=1.4,<2.0.0 | ||
django>=2.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rather change .
at the top of the file to .[django,sqlalchemy]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me, Galaxy brain, makes a comment requesting a change, then merges immediately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll create a PR for that if you haven't done it already.
from typing import ( | ||
TYPE_CHECKING, | ||
Any, | ||
Callable, | ||
Dict, | ||
Iterable, | ||
List, | ||
Optional, | ||
Set, | ||
Union, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, I'm not used to having so many imports from a module they don't fit on a single line :D. Well pixel real estate is cheap and if Black wants to spend a bazillion lines, it may well.
This PR adds a connector for SQLAlchemy with Psycopg2. The goal is for synchronous applications that use SQLAlchemy (e.g. a Flask application with the Flask-SQLAlchemy extension) to use just one SQLAlchemy engine, so just one connection pool, thereby minimizing the number of connections opened against the PostgreSQL server.
It works like this:
Closes #445
Successful PR Checklist: