Skip to content

Commit

Permalink
fix support for GetItems TableName
Browse files Browse the repository at this point in the history
  • Loading branch information
assaf758 committed Dec 17, 2023
1 parent c29d493 commit 6888854
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 0 deletions.
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 the table - using GetItems TableName (if used, table_path must be an empty string). Allows for specifying all tables with '/*'
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 the table - using GetItems TableName (if used, table_path must be an empty string). Allows for specifying all tables with '/*'
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

0 comments on commit 6888854

Please sign in to comment.