Add return_not_null_data_as_optional parameter to read_table - #880
Add return_not_null_data_as_optional parameter to read_table#880krasnovdm wants to merge 1 commit into
Conversation
vgvoleg
left a comment
There was a problem hiding this comment.
hi! please update your branch to latest main and add some tests
7d89bdd to
ea13389
Compare
|
Thanks for the review! Done:
PTAL 🙏 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #880 +/- ##
=======================================
Coverage 82.36% 82.36%
=======================================
Files 99 99
Lines 12753 12759 +6
Branches 1242 1245 +3
=======================================
+ Hits 10504 10509 +5
- Misses 1795 1796 +1
Partials 454 454
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@krasnovdm please fix ci checks. |
|
@vgvoleg pushed a fix for the failing lint jobs — reformatted |
f7aaed5 to
397be14
Compare
|
Rebased onto latest |
Adds the return_not_null_data_as_optional flag to read_table (sync and async), mirroring the existing gRPC field and the C++ SDK's ReturnNotNullAsOptional. Default behavior is unchanged (NOT NULL columns stay wrapped in Optional for backward compatibility). Unit tests added to ydb/table_test.py.
397be14 to
56c508d
Compare
|
Small follow-up: moved the unit tests into the existing |
Problem
read_tablealways returnsNOT NULLcolumns wrapped inOptional, and there is no way to opt out in the Python SDK.The gRPC
ReadTableRequestalready has areturn_not_null_data_as_optionalfield, and the C++ SDK exposes it viaTReadTableSettings().ReturnNotNullAsOptional(false). The Python SDK simply never set this field, so users reading a table withNOT NULLcolumns always getOptionalvalues back.Change
Add a
return_not_null_data_as_optionalparameter toread_table(syncydb/table.pyand asyncydb/aio/table.py) and plumb it throughread_table_request_factory. It accepts abool(mapped toFeatureFlag.ENABLED/DISABLED) or a rawFeatureFlag.Status.Default behavior is unchanged: when the parameter is not provided, the field is left unset and
NOT NULLcolumns are still returned asOptional(backward compatible).