Comments (2)
Hey @okayhooni! I'm here to help you with any bugs, questions, or contributions you have for the project. Let's squash those bugs together! 🐞
The issue you're encountering with TIMESTAMP WITH TIME ZONE
values from Trino in Apache Superset version 3.1.3 has been addressed in several pull requests, but the changes were later removed. Here are the key points and solutions:
-
PR 19263: This pull request introduced changes to handle
TIMESTAMP WITH TIME ZONE
values correctly. It added a method to convert these values to a SQL expression in thedb_engine_specs/presto.py
file. -
PR 21737: This pull request also aimed to fix issues related to
TIMESTAMP WITH TIME ZONE
values from Trino, but specific changes related to this were not detailed in the provided context. -
PR 22871: This pull request removed the changes introduced in the previous pull requests, which might have reintroduced the issue.
To fix the issue, you can manually reapply the changes from PR 19263 to your local db_engine_specs/presto.py
file. Here is the relevant code snippet:
class PrestoBaseEngineSpec(BaseEngineSpec, metaclass=ABCMeta):
"""
A base class that share common functions between Presto and Trino
"""
supports_dynamic_schema = True
supports_catalog = supports_dynamic_catalog = True
column_type_mappings = (
# ... other mappings ...
(
re.compile(r"^timestamp with time zone.*", re.IGNORECASE),
types.TIMESTAMP(timezone=True),
GenericDataType.TEMPORAL,
),
# ... other mappings ...
)
@classmethod
def convert_dttm(
cls, target_type: str, dttm: datetime, db_extra: dict[str, Any] | None = None
) -> str | None:
"""
Convert a Python `datetime` object to a SQL expression.
:param target_type: The target type of expression
:param dttm: The datetime object
:param db_extra: The database extra object
:return: The SQL expression
Superset only defines time zone naive `datetime` objects, though this method
handles both time zone naive and aware conversions.
"""
sqla_type = cls.get_sqla_column_type(target_type)
if isinstance(sqla_type, types.Date):
return f"DATE '{dttm.date().isoformat()}'"
if isinstance(sqla_type, types.TIMESTAMP):
if dttm.tzinfo is not None:
return f"""TIMESTAMP WITH TIME ZONE '{dttm.isoformat(timespec="microseconds", sep=" ")}'"""
return f"""TIMESTAMP '{dttm.isoformat(timespec="microseconds", sep=" ")}'"""
return None
Additionally, ensure that both the Apache Superset backend and the database engine are configured to use the same timezone, preferably UTC, to avoid inconsistencies [1][2][3].
For further details, you can refer to the pull requests:
Details
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
from superset.
I found this issue was related to the bug on trino-python-client
itself.
this issue was fixed on v0.324
of that library, so I solved this issue by updating this dependency from v0.321
to 0.328
- related MR: trinodb/trino-python-client#368
from superset.
Related Issues (20)
- SPAM
- SPAM
- SPAM
- SPAM
- SPAM
- SPAM
- SPAM
- Default native filters values don't set correctly HOT 1
- Superset 4.0.1 - Exported CSV Contains Garbled Chinese Characters and Numbers HOT 10
- Metric datatype incorrect when swap dataset HOT 1
- It is proposed to add the feature of grouping like folders HOT 3
- TimeSeries Chart is showing Year for the January month HOT 5
- Storybook controls are out of date HOT 1
- D3_FORMATS PROBLEM HOT 5
- Request execution time jumps HOT 1
- Unexpected error HOT 2
- Failed to setup alerts and reports based pypi installation HOT 6
- 4.0.1: Alerting and reports does not take EMAIL RECIPIENTS* HOT 4
- Filter does not follow label HOT 1
- [SIP-138] Proposal for Slack file upload V2 integration for Alerts and Reports HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superset.