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

Fix support for GetItems' TableName parameter #111

Merged
merged 5 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,18 @@ def test_kv(self):
filter_expression="age > 15",
).all()

self.assertEqual(2, len(received_items))
for item in received_items:
self.assertLess(15, item["age"])

received_items = self._client.kv.new_cursor(
container=self._container,
table_path="",
table_name=self._path,
attribute_names=["age", "feature"],
filter_expression="age > 15",
).all()

self.assertEqual(2, len(received_items))
for item in received_items:
self.assertLess(15, item["age"])
Expand Down
12 changes: 12 additions & 0 deletions tests/test_client_aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,18 @@ async def test_kv(self):
filter_expression="age > 15",
).all()

self.assertEqual(2, len(received_items))
for item in received_items:
self.assertLess(15, item["age"])

received_items = await self._client.kv.new_cursor(
container=self._container,
table_path="",
table_name=self._path,
attribute_names=["age", "feature"],
filter_expression="age > 15",
).all()

self.assertEqual(2, len(received_items))
for item in received_items:
self.assertLess(15, item["age"])
Expand Down
5 changes: 5 additions & 0 deletions v3io/aio/dataplane/kv.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def new_cursor(
self,
container,
table_path,
table_name=None,
access_key=None,
raise_for_status=None,
attribute_names="*",
Expand All @@ -47,6 +48,7 @@ def new_cursor(
container,
access_key or self._access_key,
table_path,
table_name,
raise_for_status,
attribute_names,
filter_expression,
Expand Down Expand Up @@ -205,6 +207,7 @@ async def scan(
self,
container,
table_path,
table_name=None,
access_key=None,
raise_for_status=None,
attribute_names="*",
Expand All @@ -228,6 +231,8 @@ async def scan(
The container on which to operate.
table_path (Required) : str
The full path of the table
table_name (Optional) : str
The name of the table. Allows for specifying all tables with '/*'. If used, table_path must be an empty
assaf758 marked this conversation as resolved.
Show resolved Hide resolved
access_key (Optional) : str
The access key with which to authenticate. Defaults to the V3IO_ACCESS_KEY env.
attribute_names (Optional) : []str or '*'
Expand Down
3 changes: 3 additions & 0 deletions v3io/aio/dataplane/kv_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(
container_name,
access_key,
table_path,
table_name,
raise_for_status=None,
attribute_names="*",
filter_expression=None,
Expand All @@ -42,6 +43,7 @@ def __init__(
# get items params
self.raise_for_status = raise_for_status
self.table_path = table_path
self.table_name = table_name
self.attribute_names = attribute_names
self.filter_expression = filter_expression
self.marker = marker
Expand Down Expand Up @@ -81,6 +83,7 @@ async def next_item(self):
self._current_response = await self._context.kv.scan(
self._container_name,
self.table_path,
self.table_name,
self._access_key,
self.raise_for_status,
self.attribute_names,
Expand Down
5 changes: 5 additions & 0 deletions v3io/dataplane/kv.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def new_cursor(
self,
container,
table_path,
table_name=None,
access_key=None,
raise_for_status=None,
attribute_names="*",
Expand All @@ -47,6 +48,7 @@ def new_cursor(
container,
access_key or self._access_key,
table_path,
table_name,
raise_for_status,
attribute_names,
filter_expression,
Expand Down Expand Up @@ -228,6 +230,7 @@ def scan(
self,
container,
table_path,
table_name=None,
access_key=None,
raise_for_status=None,
transport_actions=None,
Expand All @@ -252,6 +255,8 @@ def scan(
The container on which to operate.
table_path (Required) : str
The full path of the table
table_name (Optional) : str
The name of the table. Allows for specifying all tables with '/*'. If used, table_path must be an empty
assaf758 marked this conversation as resolved.
Show resolved Hide resolved
access_key (Optional) : str
The access key with which to authenticate. Defaults to the V3IO_ACCESS_KEY env.
attribute_names (Optional) : []str or '*'
Expand Down
3 changes: 3 additions & 0 deletions v3io/dataplane/kv_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(
container_name,
access_key,
table_path,
table_name,
raise_for_status=None,
attribute_names="*",
filter_expression=None,
Expand All @@ -42,6 +43,7 @@ def __init__(
# get items params
self.raise_for_status = raise_for_status
self.table_path = table_path
self.table_name = table_name
self.attribute_names = attribute_names
self.filter_expression = filter_expression
self.marker = marker
Expand Down Expand Up @@ -83,6 +85,7 @@ def next_item(self):
self._current_response = self._context.kv.scan(
self._container_name,
self.table_path,
self.table_name,
self._access_key,
self.raise_for_status,
None,
Expand Down