snowflake-sqlalchemy icon indicating copy to clipboard operation
snowflake-sqlalchemy copied to clipboard

SNOW-227101: fix to datetime columns being created without timezone

Open Nazarii opened this issue 5 years ago • 7 comments

Original ticket.

Commit 28e8031 introduced a bug where all sqlalchemy.DateTime(timezone=True) columns were created as DATETIME in Snowflake which is an alias to TIMESTAMP_NTZ. This commit reverts datetime logic back so if the timezone is defined in datetime column it will create TIMESTAMP_TZ and TIMESTAMP_NTZ otherwise. This bug was introduced in v1.1.18

Nazarii avatar Nov 19 '20 19:11 Nazarii

@Nazarii do you know when this commit can be merged? and also is a reason that take out these TIMESTAMP_TZ from v1.1.8?

WeiGuHS avatar Nov 20 '21 20:11 WeiGuHS

@WeiGuHS no idea, this PR has no reviewers assigned, the same with the original ticket. I have no permissions to assign PR, I'll try to ping other contributors to review. It looks like the support of TIMESTAMP_TZ was removed by a mistake.

Nazarii avatar Nov 20 '21 22:11 Nazarii

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

github-actions[bot] avatar Apr 20 '22 10:04 github-actions[bot]

I have read the CLA Document and I hereby sign the CLA

Nazarii avatar Apr 20 '22 14:04 Nazarii

Not sure why but this PR shows there are conflicts. Diff does not show any merge conflicts or maybe there are some other conflicts?

Nazarii avatar Apr 20 '22 20:04 Nazarii

We will revisit this issue shortly. In the meantime TIMESTAMP is an alias that is configurable actually, please see our docs to see how to change what it points at.

sfc-gh-mkeller avatar Apr 27 '22 19:04 sfc-gh-mkeller

@sfc-gh-mkeller any news on this?

conflicts comes from GEOGRAPHY being added at the same spot in the file as your modifications

      def visit_TIMESTAMP(self, type_, **kw):
++<<<<<<< HEAD
 +        return "TIMESTAMP"
 +
 +    def visit_GEOGRAPHY(self, type_, **kw):
 +        return "GEOGRAPHY"
++=======
+         is_local = kw.get('is_local', False)
+         timezone = kw.get('timezone', type_.timezone)
+         return "TIMESTAMP %s%s" % (
+             (timezone and "WITH" or "WITHOUT") + (
+                     is_local and " LOCAL" or "") + " TIME ZONE",
+             "(%d)" % type_.precision if getattr(type_, 'precision',
+                                                None) is not None else ""
+         )
++>>>>>>> 9620a0a (SNOW-227101: fix to datetime columns being created without timezone (TIMESTAMP_NTZ).)```

philippeboyd avatar May 12 '22 20:05 philippeboyd