Skip to content

[Bug] Metadata string value returned as datetime.date #161

Closed

Description

@mneira10

Is this a new bug in the Pinecone Python client?

  • I believe this is a new bug in the Pinecone Python Client
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

If you upload a metadata field with a certain format, for example the string "1002.6.3" , pinecone will return the datetime object: datetime.date(1002,6,2) instead of the string "1002.6.3"

I'm not certain of all of the formats that lead to his behavior

Expected Behavior

The returned metadata value should be the string "1002.6.3"

Steps To Reproduce

  1. upload a vector with metadata: {"exampleField": "1002.6.3"}
  2. query the database for that vector. You'll see a datetime.date object instead of a string

Relevant log output

No response

Environment

- OS: MacOS Monterrey (12.2.1)
- Python: 3.11.2
- pinecone: 2.2.1

Additional Context

Note that the value is correctly stored in pinecone but the sdk is returning it as a datetime object

Activity

  1. added
    bug
    on Apr 5, 2023
  2. rajat08 commented on Apr 5, 2023

    @rajat08
    Contributor

    @mneira10 this is a known bug at the moment. This is because the openapi generated code we use for our REST client does this conversion as the spec does not clearly define all accepted openapi types. While we fix this, I suggest using GRPCIndex; it will be fine there.

  3. mneira10 commented on Apr 5, 2023

    @mneira10
    Author

    Thanks for the swift response!

    I suggest using GRPCIndex; it will be fine there.

    Good to know! Thanks


    As a possible workaround for others facing the same issue. You can adjust the formatting by adding a prefix or similar so that it won't be picked up as a date

  4. rajat08 commented on Apr 5, 2023

    @rajat08
    Contributor

    Thanks for the suggestion :)
    I think it might be better to make these changes at the proto/spec level and avoid other data type-related issues. Our v3 client is in dev release atm (stable release should be out soon), but it is gRPC only and hence avoids some issues like these, which are downstream of our json-grpc transcoding decisions.

  5. masonchambersiii commented on Jul 12, 2023

    @masonchambersiii

    Was this ever resolved? Im still running into this issue?

  6. rajat08 commented on Jul 12, 2023

    @rajat08
    Contributor

    Was this ever resolved? Im still running into this issue?

    Not yet for REST. Can you use GRPCIndex?

  7. masonchambersiii commented on Jul 12, 2023

    @masonchambersiii

    Ended up just using the GRPC and it works fine -- but pretty surprised this issue hasnt been resolved for rest!

  8. mneira10 commented on Jan 30, 2024

    @mneira10
    Author

    Hi @rajat08 ! Is this solved in the the v3.0.x versions?

    Our v3 client is in dev release atm (stable release should be out soon), but it is gRPC only and hence avoids some issues like these, which are downstream of our json-grpc transcoding decisions.

    I see that the upgrade guide has a dedicated section to on how to use a gRPC index which suggests that v3.x doesn't use gRPC by default with:

    # does this use gRPC? If not, does it now handle strings well?
    pc = Pinecone(api_key=...)
    index = pc.Index(PINECONE_INDEX_NAME)

    Should we use this instead?

    pc = PineconeGRPC(api_key=...)
    index = pc.Index(PINECONE_INDEX_NAME)
  9. zeke-emerson commented on Feb 6, 2024

    @zeke-emerson

    @mneira10 This issue is fixed in v3.0.x of the Python client! To be clear, the fix allows the non-GRPC client to handle date strings as expected.

  10. mneira10 commented on Feb 6, 2024

    @mneira10
    Author

    the fix allows the non-GRPC client to handle date strings as expected.

    That's awesome! Thanks for clarifying that! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions