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

fix(sql-lab): remove redundant onChange schema property #24422

Merged
merged 2 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const store = mockStore({
queries: {
LCly_kkIN: {
cached: false,
changedOn: Date.now(),
changed_on: new Date().toISOString(),
db: 'main',
dbId: 1,
id: 'LCly_kkIN',
Expand All @@ -71,7 +71,7 @@ const store = mockStore({
},
lXJa7F9_r: {
cached: false,
changedOn: 1559238500401,
changed_on: new Date(1559238500401).toISOString(),
db: 'main',
dbId: 1,
id: 'lXJa7F9_r',
Expand All @@ -80,7 +80,7 @@ const store = mockStore({
},
'2g2_iRFMl': {
cached: false,
changedOn: 1559238506925,
changed_on: new Date(1559238506925).toISOString(),
db: 'main',
dbId: 1,
id: '2g2_iRFMl',
Expand All @@ -89,7 +89,7 @@ const store = mockStore({
},
erWdqEWPm: {
cached: false,
changedOn: 1559238516395,
changed_on: new Date(1559238516395).toISOString(),
db: 'main',
dbId: 1,
id: 'erWdqEWPm',
Expand Down
3 changes: 0 additions & 3 deletions superset-frontend/src/SqlLab/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ export const queries = [
progress: 100,
startDttm: 1476910566092.96,
state: QueryState.SUCCESS,
changedOn: 1476910566000,
tempTable: null,
userId: 1,
executedSql: null,
Expand Down Expand Up @@ -276,7 +275,6 @@ export const queries = [
progress: 100,
startDttm: 1476910570802.2,
state: QueryState.SUCCESS,
changedOn: 1476910572000,
tempTable: null,
userId: 1,
executedSql:
Expand Down Expand Up @@ -310,7 +308,6 @@ export const queryWithNoQueryLimit = {
progress: 100,
startDttm: 1476910566092.96,
state: QueryState.SUCCESS,
changedOn: 1476910566000,
tempTable: null,
userId: 1,
executedSql: null,
Expand Down
5 changes: 3 additions & 2 deletions superset-frontend/src/SqlLab/reducers/sqlLab.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,9 @@ export default function sqlLabReducer(state = {}, action) {
(state.queries[id].state !== QueryState.STOPPED &&
state.queries[id].state !== QueryState.FAILED)
) {
if (changedQuery.changedOn > queriesLastUpdate) {
queriesLastUpdate = changedQuery.changedOn;
const changedOn = Date.parse(changedQuery.changed_on);
if (changedOn > queriesLastUpdate) {
queriesLastUpdate = changedOn;
}
const prevState = state.queries[id]?.state;
const currentState = changedQuery.state;
Expand Down
2 changes: 1 addition & 1 deletion superset/charts/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class ChartEntityResponseSchema(Schema):
id = fields.Integer(metadata={"description": id_description})
slice_name = fields.String(metadata={"description": slice_name_description})
cache_timeout = fields.Integer(metadata={"description": cache_timeout_description})
changed_on = fields.String(metadata={"description": changed_on_description})
changed_on = fields.DateTime(metadata={"description": changed_on_description})
description = fields.String(metadata={"description": description_description})
description_markeddown = fields.String(
metadata={"description": description_markeddown_description}
Expand Down
2 changes: 1 addition & 1 deletion superset/explore/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class SliceSchema(Schema):
certified_by = fields.String(
metadata={"description": "Person or group that has certified this dashboard."}
)
changed_on = fields.String(
changed_on = fields.DateTime(
metadata={"description": "Timestamp of the last modification."}
)
changed_on_humanized = fields.String(
Expand Down
1 change: 0 additions & 1 deletion superset/models/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def get_template_processor(self, **kwargs: Any) -> BaseTemplateProcessor:

def to_dict(self) -> dict[str, Any]:
return {
"changedOn": self.changed_on,
"changed_on": self.changed_on.isoformat(),
"dbId": self.database_id,
"db": self.database.database_name if self.database else None,
Expand Down
3 changes: 1 addition & 2 deletions superset/sqllab/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ class ExecutePayloadSchema(Schema):


class QueryResultSchema(Schema):
changedOn = fields.DateTime()
changed_on = fields.String()
changed_on = fields.DateTime()
dbId = fields.Integer()
db = fields.String() # pylint: disable=invalid-name
endDttm = fields.Float()
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/queries/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ def test_get_updated_since(self):
for key, value in data["result"][0].items():
# We can't assert timestamp
if key not in (
"changedOn",
"changed_on",
"end_time",
"start_running_time",
Expand Down