GenieFramework / GenieFramework/SearchLight.jl
Date and DateTimes in DB Schemas
- Dominant language
- Julia
- Stars
- 149
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I am fairly new to Julia and I have started out using Genie Framework just today.
I created this model with a Date field in it:
`
using SearchLight
using Dates
mutable struct Customer <: AbstractModel
_table_name::String
_id::String
_serializable::Vector{Symbol}
Name::String
CreateTime::Date
id::DbId
end
`
It is correctly saved to SQLite as type of "DATE". However, when I try to read the record it fails to convert String to type Date at the line below.
[Conversion line](https://github.com/GenieFramework/SearchLight.jl/blob/324412fe4f533bc30bae333461f33b6e3144c617/src/SearchLight.jl#L1757)
`convert(Dates.Date, "2019-09-01")`
throws the same exception. I could not find a workaround for this on the Internet. What is the correct approach for developers to work with Date types?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the conversion at src/SearchLight.jl line 1757 and reproduce the failure using the issue's Customer model, a Date field, and SQLite. Check how database DATE values are read and how Julia Dates.Date parsing is expected to work. Done means records with Date fields can be read successfully without the String-to-Date conversion exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia, sqlite
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100