New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for date/time to SQLite #184

Closed
sgrif opened this Issue Feb 3, 2016 · 11 comments

Comments

Projects
None yet
7 participants
@sgrif
Member

sgrif commented Feb 3, 2016

Currently SQLite has no support for any of the date/time types. Let's add support back for these, as well as SystemTime. We should probably have an intermediate struct which others can reason about, similar to how we handled PgDate and friends.

@sgrif sgrif added the sqlite label Feb 3, 2016

@sgrif sgrif changed the title from [SQLite] Add support for date/time to Add support for date/time to SQLite Feb 3, 2016

@aperezdc

This comment has been minimized.

Contributor

aperezdc commented Dec 31, 2016

There's an attempt to implement this in PR #344 — which is a bit old and seems to need some love.

@euclio

This comment has been minimized.

euclio commented Jan 25, 2017

Any way I can help get this moving? What still needs to be done?

@kballard

This comment has been minimized.

kballard commented Feb 17, 2017

Same here. I'd love to see this get done, and I'm happy to help if someone wants to provide some direction.

@killercup

This comment has been minimized.

Member

killercup commented Feb 17, 2017

@euclio @kballard sorry, I wasn't watching this issue. We would definitely appreciate your help! I'm not sure I can really follow it, but I think the main issue with #344 is that we need to make sure that SQLite gives us date/times in a format we can definitely parse.

Maybe you can drop by our Gitter room and we see how we can tackle this?

@euclio euclio referenced this issue Feb 27, 2017

Closed

0.12 Roadmap RFC #761

dbrgn added a commit to dbrgn/diesel that referenced this issue Apr 5, 2017

Ignore date expression doctest for now
Sqlite doesn't support dates yet, see diesel-rs#184

killercup added a commit that referenced this issue Apr 6, 2017

Expression examples (#840)
* Add example for count expression
* Add "animals" test table to `doctest_setup.rs`
  It contains an integer column (for testing aggregation functions) and a
  nullable column (for testing things like `count(<col>)`.
* Add example for avg expression
* Add currently non-working example for avg function
  We cannot add an example with integer averages as long they return a `Numeric` when folding.
* Add examples for max and min expressions
* Add example for date expression
  But ignore date expression doctest for now as sqlite doesn't support dates yet (see #184)
@Eijebong

This comment has been minimized.

Member

Eijebong commented May 13, 2017

Oh, I missed this one :o

Can this be closed now or is SQLite still missing something regarding date/time ? (see #887)

@sgrif

This comment has been minimized.

Member

sgrif commented May 13, 2017

Yeah, I think so. I had envisioned broader support than #887 added, but I don't see any way to do that since we have to do string parsing with these types.

@sgrif sgrif closed this May 13, 2017

@gentoo90

This comment has been minimized.

gentoo90 commented May 13, 2017

Are there any plans to add schema inference for DATE, TIME, DATETIME and TIMESTAMP?
Currently (master, 560f650) they all fail:

diesel/diesel_cli $ sqlite3 test_datetime.db 'CREATE TABLE test (id INTEGER PRIMARY KEY, dt DATETIME)'
diesel/diesel_cli $ echo 'DATABASE_URL=test_datetime.db' > .env
diesel/diesel_cli $ RUST_BACKTRACE=1 cargo run print-schema
    Finished release [optimized] target(s) in 0.0 secs
     Running `/home/igor/projects/rust/diesel/target/release/diesel print-schema`
thread 'main' panicked at 'Could not load table `test`: StringError("Error determining type of test.dt: Unsupported type: datetime")', /checkout/src/libcore/result.rs:859

@sgrif sgrif reopened this May 13, 2017

@sgrif

This comment has been minimized.

Member

sgrif commented May 13, 2017

/cc @Eijebong

@Eijebong

This comment has been minimized.

Member

Eijebong commented May 13, 2017

Yeah, it makes sense. Fixing it

Edit: after lunch

@Eijebong

This comment has been minimized.

Member

Eijebong commented May 14, 2017

This is now fixed. @gentoo90, thanks for the report :)

@Eijebong Eijebong closed this May 14, 2017

@gentoo90

This comment has been minimized.

gentoo90 commented May 16, 2017

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment