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

Use SYSDATE when func.NOW() is used #15

Merged
merged 2 commits into from Aug 19, 2015

Conversation

Projects
None yet
2 participants
@bouk
Contributor

bouk commented Aug 19, 2015

@graingert

This comment has been minimized.

Show comment
Hide comment
@graingert

graingert Aug 19, 2015

Collaborator

what's the advantage of SYSDATE over CURRENT_DATE or TRUNC(GETDATE())?

Collaborator

graingert commented Aug 19, 2015

what's the advantage of SYSDATE over CURRENT_DATE or TRUNC(GETDATE())?

@graingert

View changes

Show outdated Hide outdated tests/test_compiler.py Outdated
@graingert

View changes

Show outdated Hide outdated tests/test_compiler.py Outdated
@@ -19,6 +19,12 @@ class RedshiftImpl(postgresql.PostgresqlImpl):
__dialect__ = 'redshift'
class RedshiftCompiler(PGCompiler):

This comment has been minimized.

@graingert

graingert Aug 19, 2015

Collaborator

is there anything that gets registered to the PGCompiler that sub-classing it might miss?

@graingert

graingert Aug 19, 2015

Collaborator

is there anything that gets registered to the PGCompiler that sub-classing it might miss?

This comment has been minimized.

@bouk

bouk Aug 19, 2015

Contributor

I think the subclassing was an issue before because of the name being set on the dialect, it won't be an issue here

@bouk

bouk Aug 19, 2015

Contributor

I think the subclassing was an issue before because of the name being set on the dialect, it won't be an issue here

@graingert

This comment has been minimized.

Show comment
Hide comment
@graingert

graingert Aug 19, 2015

Collaborator

NOW() is only deprecated not removed, does it have different semantics to SYSDATE? Are you sure people never want to call this function?

Collaborator

graingert commented Aug 19, 2015

NOW() is only deprecated not removed, does it have different semantics to SYSDATE? Are you sure people never want to call this function?

@graingert

This comment has been minimized.

Show comment
Hide comment
@graingert

graingert Aug 19, 2015

Collaborator

@bouk thanks for this PR, it looks great I just have a few questions about the specifics (see above)

Collaborator

graingert commented Aug 19, 2015

@bouk thanks for this PR, it looks great I just have a few questions about the specifics (see above)

@bouk

This comment has been minimized.

Show comment
Hide comment
@bouk

bouk Aug 19, 2015

Contributor

@graingert CURRENT_DATE and TRUNC(GETDATE()) are for dates, while SYSDATE is date and time (I know, it makes no sense). Seems that's an error in the Redshift documentation

The reason I picked SYSDATE over GETDATE() is because SYSDATE includes microseconds http://docs.aws.amazon.com/redshift/latest/dg/r_GETDATE.html

Here's a screenshot of the various outputs:

The reason this change is needed is because Redshift doesn't support NOW() in the context of a table, when inserting for example:

I've made the changes you noted

Contributor

bouk commented Aug 19, 2015

@graingert CURRENT_DATE and TRUNC(GETDATE()) are for dates, while SYSDATE is date and time (I know, it makes no sense). Seems that's an error in the Redshift documentation

The reason I picked SYSDATE over GETDATE() is because SYSDATE includes microseconds http://docs.aws.amazon.com/redshift/latest/dg/r_GETDATE.html

Here's a screenshot of the various outputs:

The reason this change is needed is because Redshift doesn't support NOW() in the context of a table, when inserting for example:

I've made the changes you noted

@graingert

This comment has been minimized.

Show comment
Hide comment
@graingert

graingert Aug 19, 2015

Collaborator

Great, can you add a changelog entry, please?

Collaborator

graingert commented Aug 19, 2015

Great, can you add a changelog entry, please?

@graingert

This comment has been minimized.

Show comment
Hide comment
@graingert

graingert Aug 19, 2015

Collaborator

Ah I notice NOW() has a timezone "+00"

Collaborator

graingert commented Aug 19, 2015

Ah I notice NOW() has a timezone "+00"

@bouk

This comment has been minimized.

Show comment
Hide comment
@bouk

bouk Aug 19, 2015

Contributor

@graingert redshift doesn't even support timestamps with timezones in tables so I don't think that matters

Contributor

bouk commented Aug 19, 2015

@graingert redshift doesn't even support timestamps with timezones in tables so I don't think that matters

@bouk

This comment has been minimized.

Show comment
Hide comment
@bouk

bouk Aug 19, 2015

Contributor

Changelog added

Contributor

bouk commented Aug 19, 2015

Changelog added

@graingert

View changes

Show outdated Hide outdated CHANGES.rst Outdated

graingert added a commit that referenced this pull request Aug 19, 2015

Merge pull request #15 from bouk/fix-now
Use SYSDATE when func.NOW() is used

@graingert graingert merged commit 232ea93 into sqlalchemy-redshift:master Aug 19, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@bouk bouk deleted the bouk:fix-now branch Aug 19, 2015

haleemur pushed a commit to haleemur/redshift_sqlalchemy that referenced this pull request Sep 2, 2015

Merge pull request sqlalchemy-redshift#15 from bouk/fix-now
Use SYSDATE when func.NOW() is used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment