-
Notifications
You must be signed in to change notification settings - Fork 26
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
Adapt adapter to read directly with sql #2331
base: feature/relational-db
Are you sure you want to change the base?
Adapt adapter to read directly with sql #2331
Conversation
|
||
class ReadAdapter: | ||
connection: ( | ||
ConnectionHandler # TODO use PgConnectionHandlerService from datastore ? |
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.
This theme we should talk about with @jsangmeister. Perhaps we could easily use that from datastore, but the process/thread behavior is different.
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 I am currently getting that connection handler anyway. As far as I understand it the datastore injector that I use to initialize this variable in ln 20 delivers the PgConnectionHandlerService
when the ConnectionHandler is injected (as per this datastore init file).
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, but you need the same connection and transaction from the pool.
But I expected the base class of the ReadAdapter should be the BaseDataStoreService and the goal is to realize the same functionality like the DatastoreAdapter class, just without calling the datastore, but read/write itself.
886fa05
to
1ffa803
Compare
@@ -11,6 +11,7 @@ pytest-cov==5.0.0 | |||
pytest-profiling==1.7.0 | |||
pyupgrade==3.15.2 | |||
pyyaml==6.0.1 | |||
psycopg[binary]==3.1.18 # only dev, in production use psycopg |
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.
May be should move this to the production requirement file, which should be used for all the common base packages.
|
||
def write_data(self, payloads: list[WritePayload]) -> None: | ||
env = os.environ | ||
connect_data = f"dbname='{env['DATABASE_NAME']}' user='{env['DATABASE_USER']}' host='{env['DATABASE_HOST']}' password='{env['PGPASSWORD']}'" |
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.
One connection should serve for the whole session, read and write together
…11-adjust-adapter-read-methods
@r-peschke This is absolutely not done yet (see list of points in description), but I have the basic functionality of the read_adapter done and I changed things to the extent where it is actually used in the proper |
For now this is just a copy of the backend processes and not yet attuned to the new db schema (it's also based on @jsangmeister 's backend-setup PR)
TODO:
read_adapter.py
ReadAdapter
inadapter.py
adapter.py
payloadsfor update
behind every select query when fields are supposed to be lockedfor_update
=> Will need further deliberation@retry_on_db_failure
?