You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2023/09/01 13:24:06 UTC

[superset] branch 3.0 updated (372004d0e6 -> f778b62712)

This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a change to branch 3.0
in repository https://gitbox.apache.org/repos/asf/superset.git


    from 372004d0e6 fix: Bumps Flask Caching to fix RCE vulnerability (#25090)
     new 9837dabb2c docs: Fix typo in UPDATING.md (#25127)
     new dd0475d63c fix: add format for timestamp in crdb to correctly use times values (#24711)
     new af8f074919 fix: Handle Python date format for GENERIC_CHART_AXES feature (#25135)
     new 76d7bf9011 fix: Chart series limit doesn't work for some databases (#25150)
     new f778b62712 fix: Fixing untranslated FR strings (#20078)

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 UPDATING.md                                        |  2 +-
 .../controls/DateFilterControl/DateFilterLabel.tsx |  6 +++-
 superset/connectors/sqla/models.py                 |  4 ++-
 superset/db_engine_specs/cockroachdb.py            | 17 ++++++++-
 superset/models/helpers.py                         | 16 ++++++---
 superset/translations/fr/LC_MESSAGES/messages.json | 38 ++++++++++++++++----
 superset/translations/fr/LC_MESSAGES/messages.po   | 41 ++++++++++++++++------
 superset/translations/messages.pot                 | 21 +++++++++++
 superset/translations/pt/LC_MESSAGES/message.json  | 14 ++------
 .../{test_impala.py => test_crdb.py}               |  8 ++---
 10 files changed, 125 insertions(+), 42 deletions(-)
 copy tests/unit_tests/db_engine_specs/{test_impala.py => test_crdb.py} (83%)


[superset] 05/05: fix: Fixing untranslated FR strings (#20078)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit f778b62712ff20b2b8667261bce467a94764d32c
Author: aehanno <10...@users.noreply.github.com>
AuthorDate: Fri Sep 1 09:12:12 2023 -0400

    fix: Fixing untranslated FR strings (#20078)
    
    (cherry picked from commit 2c4629a77d5b4ef25ce45e6078023c03938830ff)
---
 .../controls/DateFilterControl/DateFilterLabel.tsx |  6 +++-
 superset/translations/fr/LC_MESSAGES/messages.json | 38 ++++++++++++++++----
 superset/translations/fr/LC_MESSAGES/messages.po   | 41 ++++++++++++++++------
 superset/translations/messages.pot                 | 21 +++++++++++
 superset/translations/pt/LC_MESSAGES/message.json  | 14 ++------
 5 files changed, 90 insertions(+), 30 deletions(-)

diff --git a/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx b/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx
index d19a423814..4898ba8fde 100644
--- a/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx
+++ b/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx
@@ -308,7 +308,11 @@ export default function DateFilterLabel(props: DateFilterControlProps) {
       <Divider />
       <div>
         <div className="section-title">{t('Actual time range')}</div>
-        {validTimeRange && <div>{evalResponse}</div>}
+        {validTimeRange && (
+          <div>
+            {evalResponse === 'No filter' ? t('No filter') : evalResponse}
+          </div>
+        )}
         {!validTimeRange && (
           <IconWrapper className="warning">
             <Icons.ErrorSolidSmall iconColor={theme.colors.error.base} />
diff --git a/superset/translations/fr/LC_MESSAGES/messages.json b/superset/translations/fr/LC_MESSAGES/messages.json
index 58ae478b43..5c000012fa 100644
--- a/superset/translations/fr/LC_MESSAGES/messages.json
+++ b/superset/translations/fr/LC_MESSAGES/messages.json
@@ -83,14 +83,14 @@
       ".": [""],
       "0 Selected": ["0 sélectionné"],
       "1 calendar day frequency": [""],
-      "1 day ago": [""],
+      "1 day ago": ["Il y a 1 jour"],
       "1 hour": ["1 heure"],
       "1 minute": ["1 minute"],
       "1 minutely frequency": [""],
       "1 month end frequency": [""],
       "1 month start frequency": [""],
-      "1 week ago": [""],
-      "1 year ago": [""],
+      "1 week ago": ["Il y a 1 semaine"],
+      "1 year ago": ["Il y a 1 an"],
       "10 minute": ["10 minutes"],
       "104 weeks ago": [""],
       "15 minute": ["15 minutes"],
@@ -100,11 +100,11 @@
       "1H": [""],
       "1M": [""],
       "1T": [""],
-      "2 years ago": [""],
+      "2 years ago": ["il y a 2 ans"],
       "2/98 percentiles": [""],
       "28 days ago": [""],
       "2D": [""],
-      "3 years ago": [""],
+      "3 years ago": ["Il y a 3 ans"],
       "30 days": ["30 jours"],
       "30 minute": ["30 minutes"],
       "30 minutes": ["30 minutes"],
@@ -1998,6 +1998,7 @@
         ""
       ],
       "Least recently modified": ["Dernière modification"],
+      "Left Axis chart(s)": [""],
       "Left Margin": [""],
       "Left margin, in pixels, allowing for more room for axis labels": [""],
       "Left to Right": [""],
@@ -2443,6 +2444,12 @@
       "Pick a granularity in the Time section or uncheck 'Include Time'": [
         "Choississez une granularité dans la section Temps ou décochez 'Inclure le temps'"
       ],
+      "Pick a metric for left axis!": [
+        "Choisissez une métrique pour l'axe de gauche !"
+      ],
+      "Pick a metric for right axis!": [
+        "Choisissez une métrique pour l'axe de droite !"
+      ],
       "Pick a metric for x, y and size": [
         "Choisissez une métrique pour x, y, taille"
       ],
@@ -3139,7 +3146,7 @@
       "Subdomain": [""],
       "Subheader Font Size": [""],
       "Submit": [""],
-      "Subtotal": [""],
+      "Subtotal": ["Sous-Total"],
       "Success": ["Succès"],
       "Suffix to apply after the percentage display": [""],
       "Sum": [""],
@@ -3743,7 +3750,11 @@
       "Thursday": ["Jeudi"],
       "Time": ["Temps"],
       "Time Series - Bar Chart": ["Séries temporelles - histogramme"],
+      "Time Series - Dual Axis Line Chart": ["Séries temporelles - double axe"],
       "Time Series - Line Chart": ["Séries temporelles - ligne"],
+      "Time Series - Multiple Line Charts": [
+        "Séries temporelles - Lignes multiples"
+      ],
       "Time Series - Nightingale Rose Chart": [
         "Séries temporelles - Graphique Nightingale Rose"
       ],
@@ -4521,6 +4532,7 @@
         "le percentile inférieur doit être plus grand que 0 et plus petit que 100 et doit être plus petit que le percentile supérieur."
       ],
       "median": [""],
+      "metric": ["métrique"],
       "minute": ["minute"],
       "minute(s)": ["minute(s)"],
       "month": ["mois"],
@@ -4578,7 +4590,19 @@
       "y": [""],
       "y: values are normalized within each row": [""],
       "year": ["année"],
-      "zoom area": [""]
+      "zoom area": [""],
+      "No matching records found": ["Aucun résultat trouvé"],
+      "Seconds %s": ["%s secondes"],
+      "Minutes %s": ["%s minutes "],
+      "10 seconds": ["10 secondes"],
+      "6 hours": ["6 heures"],
+      "12 hours": ["12 heures"],
+      "24 hours": ["24 heures"],
+      "Last day": ["Hier"],
+      "Last week": ["La semaine derniere"],
+      "Last month": ["Le mois dernier"],
+      "Last quarter": ["Le trimestre dernier"],
+      "Last year": ["L'année dernière"]
     }
   }
 }
diff --git a/superset/translations/fr/LC_MESSAGES/messages.po b/superset/translations/fr/LC_MESSAGES/messages.po
index c9bd2b6dfb..6c4cdd69c4 100644
--- a/superset/translations/fr/LC_MESSAGES/messages.po
+++ b/superset/translations/fr/LC_MESSAGES/messages.po
@@ -254,7 +254,7 @@ msgstr "%s Erreur"
 #: superset-frontend/src/features/databases/DatabaseModal/index.tsx:1355
 #, fuzzy, python-format
 msgid "%s PASSWORD"
-msgstr "Mot de passe"
+msgstr "%s Mot de passe"
 
 #: superset-frontend/src/components/ImportModal/index.tsx:318
 #: superset-frontend/src/features/databases/DatabaseModal/index.tsx:1373
@@ -457,7 +457,7 @@ msgstr "jour"
 
 #: superset-frontend/packages/superset-ui-chart-controls/src/sections/advancedAnalytics.tsx:112
 msgid "1 day ago"
-msgstr ""
+msgstr "Il y a 1 jour"
 
 #: superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx:166
 #: superset-frontend/src/explore/controls.jsx:260
@@ -500,7 +500,7 @@ msgstr "semaine"
 
 #: superset-frontend/packages/superset-ui-chart-controls/src/sections/advancedAnalytics.tsx:113
 msgid "1 week ago"
-msgstr ""
+msgstr "Il y a 1 semaine"
 
 #: superset-frontend/plugins/legacy-preset-chart-nvd3/src/TimePivot/controlPanel.ts:62
 #, fuzzy
@@ -522,7 +522,7 @@ msgstr "année"
 
 #: superset-frontend/packages/superset-ui-chart-controls/src/sections/advancedAnalytics.tsx:117
 msgid "1 year ago"
-msgstr ""
+msgstr "Il y a 1 an"
 
 #: superset-frontend/packages/superset-ui-chart-controls/src/sections/advancedAnalytics.tsx:170
 #: superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/controlPanel.tsx:243
@@ -613,7 +613,7 @@ msgstr "année"
 
 #: superset-frontend/packages/superset-ui-chart-controls/src/sections/advancedAnalytics.tsx:119
 msgid "2 years ago"
-msgstr ""
+msgstr "Il y a 2 ans"
 
 #: superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts:97
 msgid "2/98 percentiles"
@@ -657,7 +657,7 @@ msgstr "année"
 
 #: superset-frontend/packages/superset-ui-chart-controls/src/sections/advancedAnalytics.tsx:121
 msgid "3 years ago"
-msgstr ""
+msgstr "Il y a 3 ans"
 
 #: superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx:309
 #: superset-frontend/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx:191
@@ -1837,7 +1837,7 @@ msgstr ""
 #: superset-frontend/src/views/CRUD/hooks.ts:308
 #, fuzzy, python-format
 msgid "An error occurred while creating %ss: %s"
-msgstr "Une erreur s'est produite durant la récupération des jeux de données : %s"
+msgstr "Une erreur s'est produite durant la récupération des jeux de données %ss: %s"
 
 #: superset-frontend/src/SqlLab/actions/sqlLab.js:1530
 #: superset-frontend/src/SqlLab/actions/sqlLab.js:1552
@@ -1869,7 +1869,7 @@ msgstr ""
 #: superset-frontend/src/views/CRUD/hooks.ts:106
 #, fuzzy, python-format
 msgid "An error occurred while fetching %s info: %s"
-msgstr "Une erreur s'est produite durant la récupération des tableaux de bord : %s"
+msgstr "Une erreur s'est produite durant la récupération des tableaux de bord %s : %s"
 
 #: superset-frontend/src/views/CRUD/hooks.ts:174
 #: superset-frontend/src/views/CRUD/hooks.ts:265
@@ -15228,7 +15228,7 @@ msgstr ""
 #: superset/charts/post_processing.py:161
 #: superset/charts/post_processing.py:178
 msgid "Subtotal"
-msgstr ""
+msgstr "Sous-Total"
 
 #: superset-frontend/src/SqlLab/components/QueryTable/index.tsx:127
 #: superset-frontend/src/pages/AlertReportList/index.tsx:62
@@ -20511,7 +20511,7 @@ msgstr ""
 #: superset-frontend/src/explore/components/controls/FixedOrMetricControl/index.jsx:136
 #, fuzzy
 msgid "metric"
-msgstr "Métrique"
+msgstr "métrique"
 
 #: superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts:63
 #: superset-frontend/plugins/legacy-plugin-chart-map-box/src/controlPanel.ts:188
@@ -21006,3 +21006,24 @@ msgstr "année"
 #: superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:521
 msgid "zoom area"
 msgstr ""
+
+#: superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx:28
+#: superset-frontend/src/explore/components/controls/FixedOrMetricControl/index.jsx:136
+msgid "metric"
+msgstr "métrique"
+
+#: superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx:29
+msgid "10 seconds"
+msgstr "10 secondes"
+
+#: superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx:29
+msgid "6 hours"
+msgstr "6 heures"
+
+#: superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx:29
+msgid "12 hours"
+msgstr "12 heures"
+
+#: superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx:29
+msgid "24 hours"
+msgstr "24 heures"
diff --git a/superset/translations/messages.pot b/superset/translations/messages.pot
index b4156bea53..8131da3844 100644
--- a/superset/translations/messages.pot
+++ b/superset/translations/messages.pot
@@ -19208,3 +19208,24 @@ msgstr ""
 #: superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:521
 msgid "zoom area"
 msgstr ""
+
+#: superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx:28
+#: superset-frontend/src/explore/components/controls/FixedOrMetricControl/index.jsx:136
+msgid "metric"
+msgstr ""
+
+#: superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx:29
+msgid "10 seconds"
+msgstr ""
+
+#: superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx:29
+msgid "6 hours"
+msgstr ""
+
+#: superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx:29
+msgid "12 hours"
+msgstr ""
+
+#: superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx:29
+msgid "24 hours"
+msgstr ""
diff --git a/superset/translations/pt/LC_MESSAGES/message.json b/superset/translations/pt/LC_MESSAGES/message.json
index 7ff52195f5..37b1e6f4ce 100644
--- a/superset/translations/pt/LC_MESSAGES/message.json
+++ b/superset/translations/pt/LC_MESSAGES/message.json
@@ -928,7 +928,7 @@
       "When allowing CREATE TABLE AS option in SQL Lab, this option forces the table to be created in this schema": [
         "Ao permitir a opção CREATE TABLE AS no SQL Lab, esta opção força a tabela a ser criada neste esquema"
       ],
-      "If Presto, Trino or Drill all the queries in SQL Lab are going to be executed as the currently logged on user who must have permission to run them.<br/>If Hive and hive.server2.enable.doAs is enabled, will run the queries as service account, but impersonate the currently logged on user via hive.server2.proxy.user property.": [
+      "If Presto, all the queries in SQL Lab are going to be executed as the currently logged on user who must have permission to run them.<br/>If Hive and hive.server2.enable.doAs is enabled, will run the queries as service account, but impersonate the currently logged on user via hive.server2.proxy.user property.": [
         "Se Presto, todas as consultas no SQL Lab serão executadas como o utilizador atualmente conectado que deve ter permissão para as executar. <br/> Se hive e hive.server2.enable.doAs estiver habilitado, serão executadas as queries como conta de serviço, mas deve personificar o utilizador atualmente conectado recorrendo à propriedade hive.server2.proxy.user."
       ],
       "Allow SQL Lab to fetch a list of all tables and all views across all database schemas. For large data warehouse with thousands of tables, this can be expensive and put strain on the system.": [
@@ -1114,15 +1114,6 @@
       "It seems you don't have access to any database": [
         "Parece que não tem acesso a nenhuma base de dados"
       ],
-      "An error occurred when refreshing queries": [
-        "Ocorreu um erro ao criar a origem dos dados"
-      ],
-      "Filter by user": ["Valor de filtro"],
-      "Filter by database": ["Selecione uma base de dados"],
-      "Query search string": ["Pesquisa de Query"],
-      "[From]-": ["[A partir de]-"],
-      "[To]-": ["[Para]-"],
-      "Filter by status": ["Valor de filtro"],
       "Edit": ["Editar"],
       "view results": ["ver resultados"],
       "Data preview": ["Pré-visualização de dados"],
@@ -1148,7 +1139,6 @@
       "Run Selection": ["Executar a query selecionada"],
       "Run": [""],
       "Stop running (Ctrl + x)": [""],
-      "Stop running (Ctrl + e)": [""],
       "Run query (Ctrl + Return)": [""],
       "Save & Explore": ["Grave uma visualização"],
       "Overwrite & Explore": ["Substitua a visualização %s"],
@@ -2188,7 +2178,7 @@
       "Impersonate Logged In User (Presto, Trino, Drill & Hive)": [
         "Personificar o utilizador conectado"
       ],
-      "If Presto, Trino or Drill all the queries in SQL Lab are going to be executed as the currently logged on user who must have permission to run them. If Hive and hive.server2.enable.doAs is enabled, will run the queries as service account, but impersonate the currently logged on user via hive.server2.proxy.user property.": [
+      "If Presto, all the queries in SQL Lab are going to be executed as the currently logged on user who must have permission to run them. If Hive and hive.server2.enable.doAs is enabled, will run the queries as service account, but impersonate the currently logged on user via hive.server2.proxy.user property.": [
         "Se Presto, todas as consultas no SQL Lab serão executadas como o utilizador atualmente conectado que deve ter permissão para as executar. <br/> Se hive e hive.server2.enable.doAs estiver habilitado, serão executadas as queries como conta de serviço, mas deve personificar o utilizador atualmente conectado recorrendo à propriedade hive.server2.proxy.user."
       ],
       "Allow Data Upload": [""],


[superset] 03/05: fix: Handle Python date format for GENERIC_CHART_AXES feature (#25135)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit af8f0749194194021ff4455929614caf78c07e60
Author: John Bodley <45...@users.noreply.github.com>
AuthorDate: Thu Aug 31 13:50:34 2023 -0700

    fix: Handle Python date format for GENERIC_CHART_AXES feature (#25135)
    
    (cherry picked from commit de9515c29486505e81b530344d564658aa43e153)
---
 superset/connectors/sqla/models.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index d4078dbfd0..c7ea336ded 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -991,11 +991,13 @@ class SqlaTable(
         time_grain = col.get("timeGrain")
         has_timegrain = col.get("columnType") == "BASE_AXIS" and time_grain
         is_dttm = False
+        pdf = None
         if col_in_metadata := self.get_column(expression):
             sqla_column = col_in_metadata.get_sqla_col(
                 template_processor=template_processor
             )
             is_dttm = col_in_metadata.is_temporal
+            pdf = col_in_metadata.python_date_format
         else:
             sqla_column = literal_column(expression)
             if has_timegrain or force_type_check:
@@ -1012,7 +1014,7 @@ class SqlaTable(
         if is_dttm and has_timegrain:
             sqla_column = self.db_engine_spec.get_timestamp_expr(
                 col=sqla_column,
-                pdf=None,
+                pdf=pdf,
                 time_grain=time_grain,
             )
         return self.make_sqla_column_compatible(sqla_column, label)


[superset] 04/05: fix: Chart series limit doesn't work for some databases (#25150)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 76d7bf901117823ba5115a8459c78e6977e1a861
Author: KSPT-taylorjohn <52...@users.noreply.github.com>
AuthorDate: Thu Aug 31 18:05:39 2023 -0400

    fix: Chart series limit doesn't work for some databases (#25150)
    
    (cherry picked from commit bbfaeb074e76e9abf4f83d1c5823f43816bde368)
---
 superset/models/helpers.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/superset/models/helpers.py b/superset/models/helpers.py
index 8761e90933..38f29eb223 100644
--- a/superset/models/helpers.py
+++ b/superset/models/helpers.py
@@ -98,6 +98,7 @@ config = app.config
 logger = logging.getLogger(__name__)
 
 VIRTUAL_TABLE_ALIAS = "virtual_table"
+SERIES_LIMIT_SUBQ_ALIAS = "series_limit"
 ADVANCED_DATA_TYPES = config["ADVANCED_DATA_TYPES"]
 
 
@@ -1463,7 +1464,13 @@ class ExploreMixin:  # pylint: disable=too-many-public-methods
         groupby = groupby or []
         rejected_adhoc_filters_columns: list[Union[str, ColumnTyping]] = []
         applied_adhoc_filters_columns: list[Union[str, ColumnTyping]] = []
-        series_column_names = utils.get_column_names(series_columns or [])
+        db_engine_spec = self.db_engine_spec
+        series_column_labels = [
+            db_engine_spec.make_label_compatible(column)
+            for column in utils.get_column_names(
+                columns=series_columns or [],
+            )
+        ]
         # deprecated, to be removed in 2.0
         if is_timeseries and timeseries_limit:
             series_limit = timeseries_limit
@@ -1476,7 +1483,6 @@ class ExploreMixin:  # pylint: disable=too-many-public-methods
         template_kwargs["removed_filters"] = removed_filters
         template_kwargs["applied_filters"] = applied_template_filters
         template_processor = self.get_template_processor(**template_kwargs)
-        db_engine_spec = self.db_engine_spec
         prequeries: list[str] = []
         orderby = orderby or []
         need_groupby = bool(metrics is not None or groupby)
@@ -1620,8 +1626,8 @@ class ExploreMixin:  # pylint: disable=too-many-public-methods
                     )
                 groupby_all_columns[outer.name] = outer
                 if (
-                    is_timeseries and not series_column_names
-                ) or outer.name in series_column_names:
+                    is_timeseries and not series_column_labels
+                ) or outer.name in series_column_labels:
                     groupby_series_columns[outer.name] = outer
                 select_exprs.append(outer)
         elif columns:
@@ -2012,7 +2018,7 @@ class ExploreMixin:  # pylint: disable=too-many-public-methods
                     col_name = db_engine_spec.make_label_compatible(gby_name + "__")
                     on_clause.append(gby_obj == sa.column(col_name))
 
-                tbl = tbl.join(subq.alias(), and_(*on_clause))
+                tbl = tbl.join(subq.alias(SERIES_LIMIT_SUBQ_ALIAS), and_(*on_clause))
             else:
                 if series_limit_metric:
                     orderby = [


[superset] 02/05: fix: add format for timestamp in crdb to correctly use times values (#24711)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit dd0475d63c1eaf10c0aba5ae9d999ae8e7e7c153
Author: Ethan M Lewis <et...@gmail.com>
AuthorDate: Thu Aug 31 10:23:32 2023 -0700

    fix: add format for timestamp in crdb to correctly use times values (#24711)
    
    Co-authored-by: John Bodley <45...@users.noreply.github.com>
    (cherry picked from commit 321d968504e8320070b1663fdbfc1f927014f788)
---
 superset/db_engine_specs/cockroachdb.py            | 17 +++++++++++++-
 .../unit_tests/db_engine_specs/test_crdb.py        | 27 ++++++++++++++++++----
 2 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/superset/db_engine_specs/cockroachdb.py b/superset/db_engine_specs/cockroachdb.py
index 8c83bd793d..4486c569dd 100644
--- a/superset/db_engine_specs/cockroachdb.py
+++ b/superset/db_engine_specs/cockroachdb.py
@@ -14,10 +14,25 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from datetime import datetime
+from typing import Any, Optional
+
+from sqlalchemy import types
+
 from superset.db_engine_specs.postgres import PostgresEngineSpec
 
 
 class CockroachDbEngineSpec(PostgresEngineSpec):
     engine = "cockroachdb"
     engine_name = "CockroachDB"
-    default_driver = ""
+
+    @classmethod
+    def convert_dttm(
+        cls, target_type: str, dttm: datetime, db_extra: Optional[dict[str, Any]] = None
+    ) -> Optional[str]:
+        sqla_type = cls.get_sqla_column_type(target_type)
+        if isinstance(sqla_type, types.Date):
+            return f"'{dttm.date().isoformat()}'"
+        if isinstance(sqla_type, (types.String, types.DateTime)):
+            return f"""'{dttm.isoformat(sep=" ", timespec="seconds")}'"""
+        return None
diff --git a/superset/db_engine_specs/cockroachdb.py b/tests/unit_tests/db_engine_specs/test_crdb.py
similarity index 52%
copy from superset/db_engine_specs/cockroachdb.py
copy to tests/unit_tests/db_engine_specs/test_crdb.py
index 8c83bd793d..e2067d3c9d 100644
--- a/superset/db_engine_specs/cockroachdb.py
+++ b/tests/unit_tests/db_engine_specs/test_crdb.py
@@ -14,10 +14,27 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from superset.db_engine_specs.postgres import PostgresEngineSpec
+# pylint: disable=unused-argument, import-outside-toplevel, protected-access
+from datetime import datetime
+from typing import Optional
 
+import pytest
 
-class CockroachDbEngineSpec(PostgresEngineSpec):
-    engine = "cockroachdb"
-    engine_name = "CockroachDB"
-    default_driver = ""
+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
+) -> None:
+    from superset.db_engine_specs.cockroachdb import CockroachDbEngineSpec as spec
+
+    assert_convert_dttm(spec, target_type, expected_result, dttm)


[superset] 01/05: docs: Fix typo in UPDATING.md (#25127)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 9837dabb2cb0aad74eef4138968e6c3cf551add6
Author: John Bodley <45...@users.noreply.github.com>
AuthorDate: Thu Aug 31 09:55:51 2023 -0700

    docs: Fix typo in UPDATING.md (#25127)
---
 UPDATING.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UPDATING.md b/UPDATING.md
index d11a78b29f..67a9e695f7 100644
--- a/UPDATING.md
+++ b/UPDATING.md
@@ -32,7 +32,7 @@ assists people when migrating to a new version.
 
 ## 3.0.0
 
-- [25053](https://github.com/apache/superset/pull/25053): Extends the `ab_user.email` column from 64 to 320 characters which has an associated unique key constraint. This will problematic for MySQL metadata databases which use the InnoDB storage engine with the `innodb_large_prefix` parameter disabled as the key prefix limit is 767 bytes. Enabling said parameter and ensuring that the table uses either the use the `DYNAMIC` or `COMPRESSED` row format should remedy the problem. See [here]( [...]
+- [25053](https://github.com/apache/superset/pull/25053): Extends the `ab_user.email` column from 64 to 320 characters which has an associated unique key constraint. This will be problematic for MySQL metadata databases which use the InnoDB storage engine with the `innodb_large_prefix` parameter disabled as the key prefix limit is 767 bytes. Enabling said parameter and ensuring that the table uses either the `DYNAMIC` or `COMPRESSED` row format should remedy the problem. See [here](https [...]
 - [24911](https://github.com/apache/superset/pull/24911): Changes the column type from `TEXT` to `MediumText` in table `logs`, potentially requiring a table lock on MySQL dbs or taking some time to complete on large deployments.
 - [24939](https://github.com/apache/superset/pull/24939): Augments the foreign key constraints for the `embedded_dashboards` table to include an explicit CASCADE ON DELETE to ensure the relevant records are deleted when a dashboard is deleted. Scheduled downtime may be advised.
 - [24938](https://github.com/apache/superset/pull/24938): Augments the foreign key constraints for the `dashboard_slices` table to include an explicit CASCADE ON DELETE to ensure the relevant records are deleted when a dashboard or slice is deleted. Scheduled downtime may be advised.