Skip to content

what to do with DBContainer - split from removing sqlalchemy dependency #459

Open

Description

@alexanderankin

from #445 (comment)

After this discussion (with adding _wait_for_ready() and _configure() to the top level class), DBContainer would only contain this:
...
Anyway: I would appreciate if this conversation could be moved to a separate issue :-)

Activity

  1. jankatins commented on Mar 10, 2024

    @jankatins
    Contributor

    From #445

    from abc import ABC, abstractmethod
    class DBContainer(ABC):
    
        @abstractmethod
        def get_connection_url(self, *, **kwargs): # psycopg v3 cannot handle sqla style URLs, so it needs a driver=None :-(
            """Get a DB connection URL which can be used to connect to the DB."""
    
        def _create_connection_url( ... as now ...):
            """Helper to create a DB API connection URL."""

    I'm not sure if this is worth a extra class in the hierarchy, especially because it's unclear to me if that URL can be useful for all DB container or only the ones which are based on the python DB API (=RDBMS ones, not stuff like mongodb or redis): I've no clue if they also can be connected to with a single URL (kafka can not, I think).

    Given that each container would need to implement the method anyway, one could also make _create_connection_url() a pure function and let each container just declare the method themselves...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions