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 gel.Record type #560

Merged
merged 4 commits into from
Dec 12, 2024
Merged

Implement gel.Record type #560

merged 4 commits into from
Dec 12, 2024

Conversation

1st1
Copy link
Member

@1st1 1st1 commented Dec 12, 2024

It's returned from client.query_sql() and represents SQL rows.

Currently it supports:

  • integer indexing - fetch columns by position
  • string indexing - fetch columns by name
  • as_dict() method - render record as a dict

ToDo:

  • add iter

It's returned from `client.query_sql()` and represents
SQL rows.

Currently it supports:

* integer indexing - fetch columns by position
* string indexing - fetch columns by name
* as_dict() method - render record as a dict

ToDo:

* add __iter__
@1st1 1st1 requested review from msullivan, elprans and fantix December 12, 2024 22:15
@@ -284,7 +265,7 @@ object_repr(EdgeObject *o)

if (_EdgeGeneric_RenderItems(&writer,
(PyObject *)o, o->desc,
o->ob_item, Py_SIZE(o), 1, 0) < 0)
o->ob_item, Py_SIZE(o), 1, 1, 0) < 0)
Copy link
Member

Choose a reason for hiding this comment

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

You don't really need to fix this now, but this sort of list of boolean arguments ought to either have comments saying what each of the argument names are or should use #defines/enums or flag bits or something. 1, 1, 0 is inscrutable.

This is an existing problem, though, so it's fine to skip fixing it now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Much nicer

Copy link
Member

@msullivan msullivan left a comment

Choose a reason for hiding this comment

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

Looks reasonable. Kind of a lot of duplication, but you said that merging it would be worse?

gel/datatypes/record.c Outdated Show resolved Hide resolved
tests/test_async_query.py Outdated Show resolved Hide resolved
@1st1
Copy link
Member Author

1st1 commented Dec 12, 2024

@msullivan

Kind of a lot of duplication

What's duplicated? Besides the Record codec looking like a stripped down Object codec?

Edit: here's the previous attempt 00650b0

@1st1 1st1 merged commit ff3aad2 into master Dec 12, 2024
62 checks passed
@1st1 1st1 deleted the record2 branch December 12, 2024 22:56
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.

2 participants