-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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
Extend DynamoDBChatMessageHistory to support composite keys #9896
Extend DynamoDBChatMessageHistory to support composite keys #9896
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
@@ -28,10 +27,21 @@ class DynamoDBChatMessageHistory(BaseChatMessageHistory): | |||
is optional and useful for test purposes, like using Localstack. | |||
If you plan to use AWS cloud service, you normally don't have to | |||
worry about setting the endpoint_url. | |||
primary_key_name: name of the primary key of the DynamoDB table. This argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we specify that only one of primary_key_name or key should be passed in
@@ -84,6 +93,6 @@ def clear(self) -> None: | |||
from botocore.exceptions import ClientError | |||
|
|||
try: | |||
self.table.delete_item(Key={"SessionId": self.session_id}) | |||
self.table.delete_item(self.key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeError: delete_item() only accepts keyword arguments.
IMHO this should be self.table.delete_item(Key=self.key)
@joshualwhite
) **Description**: Fixed a bug introduced in version 0.0.281 in `DynamoDBChatMessageHistory` where `self.table.delete_item(self.key)` produced a TypeError: `TypeError: delete_item() only accepts keyword arguments`. Updated the method call to `self.table.delete_item(Key=self.key)` to resolve this issue. Please see also [the official AWS documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/delete_item.html#) on this **delete_item** method - only `**kwargs` are accepted. See also the PR, which introduced this bug: #9896 (comment) Please merge this, I rely on this delete dynamodb item functionality (because of GDPR considerations). **Dependencies**: None **Tag maintainer**: @hwchase17 @joshualwhite **Twitter handle**: [@BenjaminLinnik](https://twitter.com/BenjaminLinnik) Co-authored-by: Benjamin Linnik <Benjamin@Linnik-IT.de>
AWS DynamoDB Key docs