You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 5, 2025. It is now read-only.
Allow creating database connection wrapper without a singleton (#1120)
* Allow creating database connection wrapper without a singleton
The idea is that one would be able to pass the `_no_singleton` boolean
flag to the class and if so, the class would be returned without
creating a singleton.
This is handy for testing, since it would allow for several connections
to be open in parallel to different database paths, which indeed is a
testing scenario.
```
>>> from codegate.db.connection import DbCodeGate
>>> dbc = DbCodeGate(_no_singleton=True)
>>> print(dbc)
<codegate.db.connection.DbCodeGate object at 0x7f9a0f067650>
>>> dbc2 = DbCodeGate(_no_singleton=True)
>>> print(dbc2)
<codegate.db.connection.DbCodeGate object at 0x7f9a0daad1f0>
>>> dbc3 = DbCodeGate()
>>> print(dbc3)
<codegate.db.connection.DbCodeGate object at 0x7f9a0f065190>
>>> dbc4 = DbCodeGate()
>>> print(dbc4)
<codegate.db.connection.DbCodeGate object at 0x7f9a0f065190>
```
Signed-off-by: Juan Antonio Osorio <[email protected]>
* Allow passing args and kwargs to db subclasses
Signed-off-by: Juan Antonio Osorio <[email protected]>
---------
Signed-off-by: Juan Antonio Osorio <[email protected]>
0 commit comments