| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Create a new generic database subclass - DependencyFreeDbContainer Remove test that was testing sqlalchemy support for driver types Add tests for supported versions of Postgres Modify the `get_connection_url` convenience method to support a driverless url
Note that Postgres container no longer depends on SqlAlchemy Remove reference to unsupported version of postgres Show an example of using the `driver` parameter
There was a problem hiding this comment.
Thanks for the contribution. Do you think we can achieve the same outcome by overriding _connect for the postgres container and moving the content of _verify_status into _connect?
Sorry, something went wrong.
| >>> from testcontainers.postgres import PostgresContainer | ||
| >>> import sqlalchemy | ||
|
|
||
| >>> with PostgresContainer("postgres:9.5") as postgres: |
There was a problem hiding this comment.
Let's stick with 9.5 here. Pinning the version in the docs is to ensure that things don't accidentally break because one of the dependencies changed.
Sorry, something went wrong.
There was a problem hiding this comment.
According to https://www.postgresql.org/support/versioning/, 9.5 is not supported anymore, the oldest supported version is 11. My suggestion would be to go with 15 and then have another 5 years until the docs have to be changed... :-)
Sorry, something went wrong.
There was a problem hiding this comment.
Makes sense, let's bump to 15.
Sorry, something went wrong.
There was a problem hiding this comment.
... so now 16 :-)
Sorry, something went wrong.
| >>> with PostgresContainer("postgres:9.5") as postgres: | ||
| ... engine = sqlalchemy.create_engine(postgres.get_connection_url()) | ||
| >>> with PostgresContainer("postgres:latest") as postgres: | ||
| ... psql_url = postgres.get_connection_url() # postgresql+psycopg2://test:test@localhost:61472/test |
There was a problem hiding this comment.
Let's remove the comment because the url will vary depending on the environment.
Sorry, something went wrong.
|
Hi, any idea when this could be merged ? I’m using peewee as my orm and would love to get rid of that too. |
Sorry, something went wrong.
|
This could also remove the hard dependency on psycopg2 which is slowly superseded by psycopg (v3). At least for us it's now the only package which pulls in the psycopg2 binary :-/ |
Sorry, something went wrong.
There was a problem hiding this comment.
This actually needs to remove the dependencies on sqlalchemy and psycopg2
Sorry, something went wrong.
|
Hello friends, random person from the internet. If this feature was supported, it would be pretty nice. For those involved, if you could forward it (seems the developer needed some CI workflow manually triggered), it would be much appreciated 🙏 |
Sorry, something went wrong.
| for row in result: | ||
| assert row[0].lower().startswith("postgresql 9.5") | ||
| # https://www.postgresql.org/support/versioning/ | ||
| supported_versions = ["11", "12", "13", "14", "latest"] |
There was a problem hiding this comment.
please add 15 and 16 and maybe remove 11 (not supported anymore)
Sorry, something went wrong.
|
When this would be expected to be merged? |
Sorry, something went wrong.
|
@logicbomb Will you find time to get this running on top of the current main branch? If not: would you mind if I take this and rebase (or rework, if needed) and open it as a new PR (I will keep your handle as co-author on the commit)? |
Sorry, something went wrong.
Thanks for the activity, mate! I personally wouldn't mind you taking this on (my default attitude is "people are long gone" unless proven otherwise). However, if I could ask for a tweak 😇 🥺
|
Sorry, something went wrong.
So what's the alternative (in the order of my preference, best to lowest)?
This is exactly what this PR does :-) It uses both logs and pg_isready to check instead of opening a connection. It's still missing that the dependency can be removed. |
Sorry, something went wrong.
|
Hi Jen,
Sorry for the late reply, I'm happy for you to take it over - i'm working
on too many things atm.
jt
…On Mon, Mar 4, 2024 at 5:09 AM Jan Katins ***@***.***> wrote:
Make it not be in generic.py. These "db containers" assume a certain URL
format, but is it worth it to have an entire class
just for this? (I won't hide my distaste over DbContainer and why it is in
core in the first place)
So what's the alternative (in the order of my preference, best to lowest)?
- Move it to a different file?
- Make all the db container implement ´_create_connection_url()`?
- Add a different layer, like singledispatch to turn the container
into an URL?
It's possible the same thing as for kafka, I would be happy with that
approach, see
#377 <#377>
This is exactly what this PR does :-) It uses both logs and pg_isready to
check instead of opening a connection. It's still missing that the
dependency can be removed.
—
Reply to this email directly, view it on GitHub
<#340 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAASJJIOIKAHHWUN7HJNC4TYWRB6VAVCNFSM6AAAAAAXITOD2KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZWGIZDGMJYGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Sorry, something went wrong.
|
I opened #445 for the rebased version. |
Sorry, something went wrong.
…estcontainers#445) Updates the pg testcontainer implementation to not use (and not install) SQLAlchemy nor psycopg2. Closes: testcontainers#340 Closes: testcontainers#336 Closes: testcontainers#320 --------- Co-authored-by: Jason Turim <jason@opscanvas.com>
| Back | FazBrowse Home | New Git URL |
I decided to include both the log check & the pg_isready check, as it seems they both need to be successful in order to enure the database is running.
I don't think the driver parameter belongs in Postgres.__init__ method, as it's only used when building the connection string, but I didn't want to introduce any breaking changes.
Also, I am pretty new to python and was having trouble adding my fork of the project as a package to an external test project. It would be nice if there were some guidance on that in the README. I tried following the instructions in both the poetry and pip documentation, but couldn't install from github as there is neither setup.py nor pyproject.toml in the root directory.