Title: Issue parsing dates · Issue #53 · seatable/seatable-api-python · GitHub
Open Graph Title: Issue parsing dates · Issue #53 · seatable/seatable-api-python
X Title: Issue parsing dates · Issue #53 · seatable/seatable-api-python
Description: Hi! Reading date columns throws multiple warnings. Consider the following table with a couple empty (None) rows: my_date 0 2021-12-01T00:00:00Z 1 2021-12-01T00:00:00Z 2 None 3 None 4 None Fetching the my_date column throws two types of w...
Open Graph Description: Hi! Reading date columns throws multiple warnings. Consider the following table with a couple empty (None) rows: my_date 0 2021-12-01T00:00:00Z 1 2021-12-01T00:00:00Z 2 None 3 None 4 None Fetching ...
X Description: Hi! Reading date columns throws multiple warnings. Consider the following table with a couple empty (None) rows: my_date 0 2021-12-01T00:00:00Z 1 2021-12-01T00:00:00Z 2 None 3 None 4 None Fetching ...
Opengraph URL: https://github.com/seatable/seatable-api-python/issues/53
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Issue parsing dates","articleBody":"Hi! Reading `date` columns throws multiple warnings. \r\n\r\nConsider the following table with a couple empty (`None`) rows:\r\n\r\n```\r\n my_date\r\n0 2021-12-01T00:00:00Z\r\n1 2021-12-01T00:00:00Z\r\n2 None\r\n3 None\r\n4 None\r\n```\r\n\r\nFetching the `my_date` column throws two types of warnings:\r\n\r\n```python\r\n\u003e\u003e\u003e base.query('SELECT my_date FROM MyTable')\r\n[Warning] format date: Invalid isoformat string: '2021-12-01T00:00:00Z'\r\n[Warning] format date: Invalid isoformat string: '2021-12-01T00:00:00Z'\r\n[Warning] format date: fromisoformat: argument must be str\r\n[Warning] format date: fromisoformat: argument must be str\r\n[Warning] format date: fromisoformat: argument must be str\r\n\r\n[{'my_date': '2021-12-01T00:00:00Z'},\r\n {'my_date': '2021-12-01T00:00:00Z'},\r\n {'my_date': None},\r\n {'my_date': None},\r\n {'my_date': None}]\r\n```\r\n\r\n1. Invalid isoformat string:\r\n\r\nThe culprit for this appears to be this line:\r\n\r\nhttps://github.com/seatable/seatable-api-python/blob/992214166a8b52b6838ffcb9f3ae184731448227/seatable_api/utils.py#L139 \r\n\r\nApparently, `datetime.fromisoformat` does not like the trailing `Z` (see [this](https://stackoverflow.com/questions/19654578/python-utc-datetime-objects-iso-format-doesnt-include-z-zulu-or-zero-offset) post on stack overflow): \r\n\r\n2. Argument must be a str:\r\n\r\nThe problem here is that the same try/except block as above does not cater for empty rows. \r\n\r\nThese issues are obviously not show stoppers but since each row will cause a warning (that can't be suppressed because it's a `print` statement) this becomes really annoying for longer tables. \r\n\r\nOn a general note: Is that implicit (re-)formatting strictly necessary? For example, I'm typically converting data into `pandas` data frames anyway and `pandas.to_datetime()` has no issues with the full string - even parses the correct time zone:\r\n\r\n```python\r\n\u003e\u003e\u003e pd.to_datetime('2021-12-01T00:00:00Z')\r\nTimestamp('2021-12-01 00:00:00+0000', tz='UTC')\r\n```\r\n\r\nFYI: This is with `seatable_api` version `2.5.1`.\r\n\r\nI also have a separate question on writing dates to SeaTable: I've tried writing a timestamp back to the table (via batch update) and it appears as if for iso-formatted strings (e.g. `2021-12-01T11:00:05Z`) the date is correct ingested but the time is dropped. Can you tell me what the expected format is?\r\n\r\nThanks,\r\nPhilipp","author":{"url":"https://github.com/schlegelp","@type":"Person","name":"schlegelp"},"datePublished":"2021-12-14T16:08:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/53/seatable-api-python/issues/53"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:16ca1253-e79e-c33d-28b8-f435a11bf801 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8CDC:182BE3:3D903C:554FD3:6A5A4CF2 |
| html-safe-nonce | 3b144e234c37fa0ed18eb4d7e234bbad7760544d41069d12782a77ff7cde2722 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Q0RDOjE4MkJFMzozRDkwM0M6NTU0RkQzOjZBNUE0Q0YyIiwidmlzaXRvcl9pZCI6IjMzNTQzNTAzODE3MTU1NzQwMDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 68959bafab11cf69adbc3e789061988e5d83c7561fdb0fd639d24ae274c40824 |
| hovercard-subject-tag | issue:1079943610 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/seatable/seatable-api-python/53/issue_layout |
| twitter:image | https://opengraph.githubassets.com/94462c6fd22e1d8f76818efd6acca9ecd18e0d366c325ac3fbf48b316f65c3b2/seatable/seatable-api-python/issues/53 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/94462c6fd22e1d8f76818efd6acca9ecd18e0d366c325ac3fbf48b316f65c3b2/seatable/seatable-api-python/issues/53 |
| og:image:alt | Hi! Reading date columns throws multiple warnings. Consider the following table with a couple empty (None) rows: my_date 0 2021-12-01T00:00:00Z 1 2021-12-01T00:00:00Z 2 None 3 None 4 None Fetching ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | schlegelp |
| hostname | github.com |
| expected-hostname | github.com |
| None | a793cd1fa898929111edad5857ee1f24ecf4bf7702525e67357cabc9df136fc3 |
| turbo-cache-control | no-preview |
| go-import | github.com/seatable/seatable-api-python git https://github.com/seatable/seatable-api-python.git |
| octolytics-dimension-user_id | 55628275 |
| octolytics-dimension-user_login | seatable |
| octolytics-dimension-repository_id | 230085244 |
| octolytics-dimension-repository_nwo | seatable/seatable-api-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 230085244 |
| octolytics-dimension-repository_network_root_nwo | seatable/seatable-api-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 311929384671aa49f385b6fcc680ae3933943203 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width