GoogleCloudPlatform / GoogleCloudPlatform/spanner-migration-tool

Timestamp parsing fails with iso8601 datetime format from CSV

Open
#355 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PLpgSQL
Stars
155
Forks
83
Avg merge
3d 7h
Merged PRs (30d)
6

Description

According to the manual, the Timestamp included in the CSV must be ISO 8601 compliant.
https://github.com/cloudspannerecosystem/harbourbridge/tree/master/sources/csv
```
- The only supported timestamp format right now is **ISO 8601**.
```

ISO 8601 states that dates and times are concatenated with a "T" as the delimiter.
https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations
However, the layout string currently used for parsing is as follows.

https://github.com/cloudspannerecosystem/harbourbridge/blob/master/sources/csv/data.go#L511
```
func convTimestamp(val string) (t time.Time, err error) {
t, err = time.Parse("2006-01-02 15:04:05", val)
```

The current layout string does not match the representation of date and time combinations defined in ISO 8601.
I think the intersection of RFC3339 and ISO8601 is the most common layout
cf) https://ijmacd.github.io/rfc3339-iso8601/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.