You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "elewis787 (via GitHub)" <gi...@apache.org> on 2023/07/16 21:51:48 UTC

[GitHub] [superset] elewis787 opened a new pull request, #24711: fix: add format for timestamp in crdb to correctly use times values

elewis787 opened a new pull request, #24711:
URL: https://github.com/apache/superset/pull/24711

   ### SUMMARY
   This PR fixes #15825 
   
   ### TESTING INSTRUCTIONS
   To test this, the following steps can be taken
   - Add db connection for cockroach db. 
   - Create a dataset that includes a table with a timestamp or timestampz column, this will be used as the temporal value when creating charts. 
   - Create a chart that leverages a temporal value
   - Inspect the generated query to see if the date format matches as expected. 
   
   This has been tested in master and version 2.1.0 with python 3.11. 
   
   In version 2.1.0 there were code changes needed to the `dict` type, this is due to a python version that was being used in the docker images of version 2.1.0. 
   
   ### ADDITIONAL INFORMATION
   - [ x] Has associated issue: #15825 
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] john-bodley commented on pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley commented on PR #24711:
URL: https://github.com/apache/superset/pull/24711#issuecomment-1640603855

   Thanks @elewis787 for the PR. Would you mind adding some unit tests? You can look at other DB engine specs for an example of how to do this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] elewis787 commented on pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "elewis787 (via GitHub)" <gi...@apache.org>.
elewis787 commented on PR #24711:
URL: https://github.com/apache/superset/pull/24711#issuecomment-1646016501

   test added and fixed lint error for the db spec file. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] elewis787 commented on pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "elewis787 (via GitHub)" <gi...@apache.org>.
elewis787 commented on PR #24711:
URL: https://github.com/apache/superset/pull/24711#issuecomment-1640685898

   sure - and I will update the link errors. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] elewis787 commented on pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "elewis787 (via GitHub)" <gi...@apache.org>.
elewis787 commented on PR #24711:
URL: https://github.com/apache/superset/pull/24711#issuecomment-1654580914

   > Looks great, thank you @elewis787!
   
   Thanks @eschutho - I pushed a few updates to hopefully fix the few linit errors that came up. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] elewis787 commented on pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "elewis787 (via GitHub)" <gi...@apache.org>.
elewis787 commented on PR #24711:
URL: https://github.com/apache/superset/pull/24711#issuecomment-1646012080

   tests added - I need to run a lint check. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] john-bodley commented on a diff in pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley commented on code in PR #24711:
URL: https://github.com/apache/superset/pull/24711#discussion_r1276820249


##########
tests/unit_tests/db_engine_specs/test_crdb.py:
##########
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=unused-argument, import-outside-toplevel, protected-access
+from datetime import datetime
+from typing import Optional
+
+import pytest
+
+from tests.unit_tests.db_engine_specs.utils import assert_convert_dttm
+from tests.unit_tests.fixtures.common import dttm
+
+
+@pytest.mark.parametrize(
+    "target_type,expected_result",
+    [
+        ("Date", "'2019-01-02'"),
+        ("TimeStamp", "'2019-01-02 03:04:05'"),
+        ("UnknownType", None),
+    ],
+)
+def test_convert_dttm(
+    target_type: str, expected_result: Optional[str], dttm: datetime

Review Comment:
   ```suggestion
       target_type: str, expected_result: Optional[str]
   ```
   
   No need to pass `dttm` as it's in the global scope.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] elewis787 commented on pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "elewis787 (via GitHub)" <gi...@apache.org>.
elewis787 commented on PR #24711:
URL: https://github.com/apache/superset/pull/24711#issuecomment-1675547188

   Any updates on this ? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sfirke commented on pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "sfirke (via GitHub)" <gi...@apache.org>.
sfirke commented on PR #24711:
URL: https://github.com/apache/superset/pull/24711#issuecomment-1701449415

   @john-bodley and @eschutho can one of you peek at this and merge if OK?  Looks like the feedback has been addressed and CI has passed now that I kicked it (it had stalled 3 weeks ago).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] elewis787 commented on a diff in pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "elewis787 (via GitHub)" <gi...@apache.org>.
elewis787 commented on code in PR #24711:
URL: https://github.com/apache/superset/pull/24711#discussion_r1276838849


##########
tests/unit_tests/db_engine_specs/test_crdb.py:
##########
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=unused-argument, import-outside-toplevel, protected-access
+from datetime import datetime
+from typing import Optional
+
+import pytest
+
+from tests.unit_tests.db_engine_specs.utils import assert_convert_dttm
+from tests.unit_tests.fixtures.common import dttm
+
+
+@pytest.mark.parametrize(
+    "target_type,expected_result",
+    [
+        ("Date", "'2019-01-02'"),
+        ("TimeStamp", "'2019-01-02 03:04:05'"),
+        ("UnknownType", None),
+    ],
+)
+def test_convert_dttm(
+    target_type: str, expected_result: Optional[str], dttm: datetime

Review Comment:
   I used https://github.com/apache/superset/blob/master/tests/unit_tests/db_engine_specs/test_athena.py#L41 as a reference when writing the test. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] elewis787 commented on a diff in pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "elewis787 (via GitHub)" <gi...@apache.org>.
elewis787 commented on code in PR #24711:
URL: https://github.com/apache/superset/pull/24711#discussion_r1276836912


##########
tests/unit_tests/db_engine_specs/test_crdb.py:
##########
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=unused-argument, import-outside-toplevel, protected-access
+from datetime import datetime
+from typing import Optional
+
+import pytest
+
+from tests.unit_tests.db_engine_specs.utils import assert_convert_dttm
+from tests.unit_tests.fixtures.common import dttm
+
+
+@pytest.mark.parametrize(
+    "target_type,expected_result",
+    [
+        ("Date", "'2019-01-02'"),
+        ("TimeStamp", "'2019-01-02 03:04:05'"),
+        ("UnknownType", None),
+    ],
+)
+def test_convert_dttm(
+    target_type: str, expected_result: Optional[str], dttm: datetime

Review Comment:
   removing dttm causes the tests to fail. I can play around with this to see what the cause is if needed. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] john-bodley merged pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley merged PR #24711:
URL: https://github.com/apache/superset/pull/24711


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sfirke commented on pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "sfirke (via GitHub)" <gi...@apache.org>.
sfirke commented on PR #24711:
URL: https://github.com/apache/superset/pull/24711#issuecomment-1701296770

   Not sure what's going on with CI here, I will close & reopen to try to trigger it


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sfirke closed pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "sfirke (via GitHub)" <gi...@apache.org>.
sfirke closed pull request #24711: fix: add format for timestamp in crdb to correctly use times values
URL: https://github.com/apache/superset/pull/24711


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #24711: fix: add format for timestamp in crdb to correctly use times values

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #24711:
URL: https://github.com/apache/superset/pull/24711#issuecomment-1640620752

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/24711?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   > Merging [#24711](https://app.codecov.io/gh/apache/superset/pull/24711?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (bddb697) into [master](https://app.codecov.io/gh/apache/superset/commit/0328dd270467e71260bfa85078beb7b38a87877b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (0328dd2) will **decrease** coverage by `10.81%`.
   > The diff coverage is `55.55%`.
   
   > :exclamation: Current head bddb697 differs from pull request most recent head e77e7d4. Consider uploading reports for the commit e77e7d4 to get more accurate results
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #24711       +/-   ##
   ===========================================
   - Coverage   68.97%   58.16%   -10.81%     
   ===========================================
     Files        1901     1901               
     Lines       74008    74016        +8     
     Branches     8183     8183               
   ===========================================
   - Hits        51047    43055     -7992     
   - Misses      20840    28840     +8000     
     Partials     2121     2121               
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `54.01% <55.55%> (-0.01%)` | :arrow_down: |
   | python | `60.85% <55.55%> (-22.61%)` | :arrow_down: |
   | sqlite | `?` | |
   | unit | `54.83% <55.55%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://app.codecov.io/gh/apache/superset/pull/24711?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [superset/db\_engine\_specs/cockroachdb.py](https://app.codecov.io/gh/apache/superset/pull/24711?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2NvY2tyb2FjaGRiLnB5) | `69.23% <55.55%> (-30.77%)` | :arrow_down: |
   
   ... and [293 files with indirect coverage changes](https://app.codecov.io/gh/apache/superset/pull/24711/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org