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

Timezone information is not passed from datetime objects through to ibis.literal #1459

Closed
cpcloud opened this issue May 30, 2018 · 3 comments
Assignees
Labels
bug Incorrect behavior inside of ibis expressions Issues or PRs related to the expression API
Milestone

Comments

@cpcloud
Copy link
Member

cpcloud commented May 30, 2018

No description provided.

@cpcloud cpcloud added bug Incorrect behavior inside of ibis expressions Issues or PRs related to the expression API labels May 30, 2018
@cpcloud cpcloud added this to the 0.14 milestone May 30, 2018
@cpcloud cpcloud self-assigned this May 30, 2018
@cpcloud cpcloud changed the title Timezone information is not passed from datetime objects in ibis.literal Timezone information is not passed from datetime objects through to ibis.literal May 30, 2018
@missing-semicolon
Copy link
Contributor

Example

This works:

now_raw = dt.utcnow()
assert now_raw.tzinfo is None
assert ibis.literal(now_raw).type().timezone is None

This has an error in the final assertion:

now_utc = pytz.utc.localize(now_raw)
assert now_utc.tzinfo is not None
assert ibis.literal(now_utc).type().timezone is not None

@missing-semicolon
Copy link
Contributor

Another literal issue:

>>> client = ibis.bigquery.connect(etc)
>>> tab = client.table('example')
>>> tab.add_column(datetime.datetime.now(), 'test').compile()
"SELECT *, '2018-06-06 15:42:05' as `test`

Timestamp literals are not compiled as timestamps / datetimes in BQ.

@cpcloud
Copy link
Member Author

cpcloud commented Jun 6, 2018

Yep, I'm working on a patch for that issue.

@cpcloud cpcloud closed this as completed in d12baa0 Jun 7, 2018
missing-semicolon added a commit to missing-semicolon/ibis that referenced this issue Jun 11, 2018
Closes ibis-project#1459

Author: Scott Lustig <scott.lustig@twosigma.com>

Closes ibis-project#1473 from missing-semicolon/timestamp-tz-literal and squashes the following commits:

0d5339b [Scott Lustig] Update test for literal timezone attr as string
1c8cf5c [Scott Lustig] Cast tzinfo to string
f2d7e1a [Scott Lustig] Merge branch 'master' of https://github.com/ibis-project/ibis into timestamp-tz-literal
02d2f94 [Scott Lustig] Implement and Test ibis.literal maintains timestamp's timezone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior inside of ibis expressions Issues or PRs related to the expression API
Projects
None yet
Development

No branches or pull requests

2 participants