-
Notifications
You must be signed in to change notification settings - Fork 27
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
Implement new database reader and writer #2833
base: feature/relational-db
Are you sure you want to change the base?
Implement new database reader and writer #2833
Conversation
…ackend into database_read_write
for get_many_request in get_many_requests | ||
} | ||
|
||
# TODO create one transaction from db |
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.
Concerning this TODO: I was under the impression that all read and write calls for one action (and sub-actions) needed to be part of the same transaction in order to allow for accurate locking. Generating it per read call seems wrong then. Is that false?
"last_login": None, | ||
"organization_management_level": None, | ||
"meeting_ids": [1, 2, 3], | ||
"organization_id": 1, |
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.
Where's the orga id coming from?
def test_too_many_mapped_fields( | ||
db_connection: Connection, db_cur: Cursor, reader: ExtendedDatabase | ||
) -> None: | ||
"""The reader should return just all fields.""" | ||
setup_data(db_connection, db_cur, data) | ||
fields = [f"field_{i}" for i in range(2000)] | ||
response = reader.get(FQID, fields) | ||
assert response == standard_response | ||
|
||
|
||
def test_mapped_fields_not_exists( | ||
db_connection: Connection, db_cur: Cursor, reader: ExtendedDatabase | ||
) -> None: | ||
setup_data(db_connection, db_cur, data) | ||
with pytest.raises(InvalidFormat) as e_info: | ||
reader.get(FQID, ["field_that_doesnt_exist"]) | ||
assert "A field does not exist in model table: " in e_info.value.msg |
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.
Why should these have different results?
) -> None: | ||
request = [ | ||
GetManyRequest("committee", [-1], ["name"]), | ||
GetManyRequest("committee", [1], ["forwarding_user_id"]), |
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.
Why the second row?
db_connection: Connection, db_cur: Cursor, reader: ExtendedDatabase | ||
) -> None: | ||
request = [ | ||
GetManyRequest("committeee", [1], ["name"]), |
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.
Why the second row
This PR is meant for a more efficient communication and should not be merged as is.