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

Allow string indexing into Record #501

Merged
merged 3 commits into from
Aug 3, 2022
Merged

Conversation

circlingthesun
Copy link
Contributor

The Record interface inherits from Sequence which only supports integer indexing. The Postgres backend supports string indexing into Records (https://github.com/encode/databases/blob/master/databases/backends/postgres.py#L135). This PR updates the interface to reflect that.

At least on the Postgres backend getitem deserializes some data types, so it's not equivalent to the _mapping property.

The Record interface inherits from Sequence which only supports integer indexing. The Postgres backend supports string indexing into Records (https://github.com/encode/databases/blob/master/databases/backends/postgres.py#L135).  This PR updates the interface to reflect that.

At least on the Postgres backend __getitem__ deserializes some data types, so it's not equivalent to the _mapping method.
databases/interfaces.py Outdated Show resolved Hide resolved
@circlingthesun
Copy link
Contributor Author

@aminalaee is there anything else you need from me?

Copy link
Member

@aminalaee aminalaee left a comment

Choose a reason for hiding this comment

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

Thank you @circlingthesun for the contribution.

@aminalaee aminalaee merged commit 77270d8 into encode:master Aug 3, 2022
@circlingthesun
Copy link
Contributor Author

Thanks for reviewing and merging this @aminalaee 🙂

gaetano-guerriero pushed a commit to athenianco/morcilla that referenced this pull request Feb 27, 2023
* Allow string indexing into Record

The Record interface inherits from Sequence which only supports integer indexing. The Postgres backend supports string indexing into Records (https://github.com/encode/databases/blob/master/databases/backends/postgres.py#L135).  This PR updates the interface to reflect that.

At least on the Postgres backend __getitem__ deserializes some data types, so it's not equivalent to the _mapping method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants