treeverse / lakeFS

lakeFS - Data version control for your data lake | Git for data
https://docs.lakefs.io
Apache License 2.0
4.24k stars 340 forks source link

Generated Python client breaks log_commits `since` parameter #7830

Open arielshaqed opened 1 month ago

arielshaqed commented 1 month ago

since is a string with "date-time" format. OpenAPI requires a code forces incorrect OpenAPI date-time format for this, basically 2024-06-04T11:40:50Z.

The generated Python client code forces an incorrect format here by including microseconds, yielding 2024-06-04T11:40:50.765432Z. As a result the call fails with a message like:

lakefs.exceptions.BadRequestException: code: 400, reason: Bad Request, body: {'message': 'parameter "since" in query has an error: string doesn\'t match the format "date-time" (regular expression "^[0-9]{4}-(0[0-9]|10|11|12)-([0-2][0-9]|30|31)T[0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]+)?(Z|(\\\\+|-)[0-9]{2}:[0-9]{2})?$")\nSchema:\n {\n "format": "date-time",\n "type": "string"\n }\n\nValue:\n "1970-01-01T00:00:00.000000+0000"\n'}

(Reported by a user.)

arielshaqed commented 1 month ago

This also occurs for the high-level Python SDK, of course.

arielshaqed commented 1 month ago

Workaround

  1. Reconfigure datetime_format in the API client:
    clt.config.datetime_format = '%Y-%m-%dT%H:%M:%SZ'
  2. If using the high-level SDK, pass it during top-level object initialization:
    repo = Repository(repository_id='my-repo', client=clt)
  3. Pass UTC-aware timestamps as the since parameter.