Skip to content
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

Inserting aware Datetime returns an error. #626

Open
MarkRatFelt opened this issue Jul 16, 2020 · 2 comments
Open

Inserting aware Datetime returns an error. #626

MarkRatFelt opened this issue Jul 16, 2020 · 2 comments

Comments

@MarkRatFelt
Copy link

I'm trying to insert some DateTime data to CrateDB, but I'm getting an error.

The datetime I'm trying to insert looks so:

Screen Shot 2020-07-16 at 16 25 41

The column is a Timestamp with time zone column.

But I get this error:

  File "/Users/chuckaguilar/PycharmProjects/postgres-cratedb-migration-tool/venv/lib/python3.7/site-packages/crate/client/http.py", line 82, in default
    delta = o - self.epoch
TypeError: can't subtract offset-naive and offset-aware datetimes

But the CrateJsonEncoder (self.epoch) is naive:

Screen Shot 2020-07-16 at 16 28 44

tzinfo is None

So... it won't work. Either I make my datetime naive, or the self.epoch gotta be aware.

@MarkRatFelt MarkRatFelt changed the title Inserting Datetime aware returns an error. Inserting aware Datetime returns an error. Jul 16, 2020
@MarkRatFelt
Copy link
Author

It'd work converting it to a string via datetime.strftime("%Y-%m-%dT%H:%M:%S.%f%z")

thanks, @autophagy :)

@chaudum
Copy link
Contributor

chaudum commented Sep 10, 2020

Related to crate/sqlalchemy-cratedb#92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants