Skip to content
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

Draft
wants to merge 3 commits into
base: feature/relational-db
Choose a base branch
from

Conversation

hjanott
Copy link
Member

@hjanott hjanott commented Feb 7, 2025

This PR is meant for a more efficient communication and should not be merged as is.

@hjanott hjanott added the feature label Feb 7, 2025
@hjanott hjanott added this to the 4.x milestone Feb 7, 2025
@hjanott hjanott self-assigned this Feb 7, 2025
for get_many_request in get_many_requests
}

# TODO create one transaction from db
Copy link
Member

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,
Copy link
Member

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?

Comment on lines +88 to +104
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
Copy link
Member

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"]),
Copy link
Member

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"]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the second row

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants