Is it possible to save datetime to DynamoDB?

前端 未结 8 1337
清酒与你
清酒与你 2021-01-17 09:46

I have the next code:

users_table = Table(users_table_name, connection=Core.aws_dynamodb_connection)
users_table.put_item(data={
  \"login\": login,
  \"pass         


        
8条回答
  •  一整个雨季
    2021-01-17 09:51

    According to alejandro-franco response .isoformat() make the trick.

    Just tested and this a working example:

    CustomerPreferenceTable.put_item(
        Item={
            "id": str(uuid4()),
            "validAfter": datetime.utcnow().isoformat(),
            "validBefore": (datetime.utcnow() + timedelta(days=365)).isoformat(),
            "tags": ["potato", "eggplant"]
        }
    )
    

提交回复
热议问题