Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-08-2020 10:25 AM
I have a small job that reconciles data in one store with a neo4j graph, everything runs swimmingly on laptop but when I move it to a container for execution I get the below error, does anyone have any ideas on where to start digging into the problem?
"database returned error [Neo.ClientError.Statement.TypeError]: Unable to construct ZonedDateTime value: Unknown time-zone ID: Local
"
07-15-2021 01:35 PM
I am also getting this same error. Were you able to find what was causing it?
07-16-2021 12:28 AM
Would you mind sharing the query that causes this?
07-16-2021 10:02 AM
Here is a sample that causes it for me. Basically any create where I am setting a time.Time
as property value:
_, err := s.WriteTransaction(func(tx neo4j.Transaction) (interface{}, error) {
_, err := tx.Run(
"CREATE (t:Test {created_at: $created_at})",
map[string]interface{}{
"created_at": time.Now(),
},
)
})
It works if I specify a timezone, eg. time.Now().UTC()
. Not sure if that is the expected behavior.
07-16-2021 11:44 AM
I can confirm this is an issue, but I'm afraid this will be hard to fix (apart from explicitly setting a time zone with .UTC()
or .In(*Location)
or using aliases mentioned at the end).
Indeed, a raw time.Time
instance corresponds to one of two Packstream types:
In your example, the constructed time.Time
refers to an implicit "Local"
time zone name, as Golang itself calls it (try e.g. time.Now().Location().String()
). This is unfortunately an invalid time zone name.
An alternative would be to call .Zone()
on the time.Time
instance, but this won't solve the problem, since it potentially returns an abbreviated time zone name such as "CEST"
in my current case, which is yet another invalid name (contrary to the valid "Europe/Paris"
e.g.).
If you care about the time zone, you will have to set it explicitly as shown above.
If you do not care about the time zone, please cast the time.Time
to one of the driver-specific, "time zone less" aliases:
neo4j.Date
neo4j.LocalTime
neo4j.LocalDateTime
While they're all aliases of the standard time.Time
, they are actually needed by the driver to be able to disambiguate the data to send to/receive from the server.
Hope it helps!
07-16-2021 12:01 PM
Got it. Thanks for the detailed explanation, it makes sense. I will stick to setting it explicitly.
All the sessions of the conference are now available online