From ef3afbde82727d1d9df6e3cdc936e2d92f14c5ca Mon Sep 17 00:00:00 2001 From: Shiva Raisinghani Date: Mon, 25 Oct 2021 03:53:06 -0700 Subject: [PATCH] refactor: Repeated boilerplate code between upload to database forms (#16756) * abstract boilerplate code into class and rename csv to file * add db migration * fix some stuff * more renaming of csv to file * rename in translations * update down revision * update down revision * bump chart version * switch to alter column name approach in db migration * fix db migration for MySQL * db migration conflict --- .../pages/docs/installation/kubernetes.mdx | 4 +- helm/superset/Chart.yaml | 2 +- helm/superset/values.yaml | 4 +- .../DatabaseSelector.test.tsx | 8 +- .../CRUD/data/database/DatabaseList.test.jsx | 2 +- .../views/CRUD/data/database/DatabaseList.tsx | 6 +- .../database/DatabaseModal/ExtraOptions.tsx | 8 +- .../data/database/DatabaseModal/index.tsx | 12 +- .../src/views/CRUD/data/database/types.ts | 4 +- superset/config.py | 2 +- superset/databases/api.py | 8 +- superset/databases/commands/export.py | 10 +- superset/databases/schemas.py | 26 ++-- .../b92d69a6643c_rename_csv_to_file.py | 48 +++++++ superset/models/core.py | 10 +- .../translations/de/LC_MESSAGES/messages.json | 2 +- .../translations/de/LC_MESSAGES/messages.po | 4 +- .../translations/en/LC_MESSAGES/messages.json | 2 +- .../translations/en/LC_MESSAGES/messages.po | 4 +- .../translations/es/LC_MESSAGES/messages.json | 2 +- .../translations/es/LC_MESSAGES/messages.po | 4 +- .../translations/fr/LC_MESSAGES/messages.json | 2 +- .../translations/fr/LC_MESSAGES/messages.po | 4 +- .../translations/it/LC_MESSAGES/messages.json | 2 +- .../translations/it/LC_MESSAGES/messages.po | 4 +- .../translations/ja/LC_MESSAGES/messages.json | 2 +- .../translations/ja/LC_MESSAGES/messages.po | 4 +- .../translations/ko/LC_MESSAGES/messages.json | 2 +- .../translations/ko/LC_MESSAGES/messages.po | 4 +- superset/translations/messages.pot | 4 +- .../translations/pt/LC_MESSAGES/message.json | 2 +- .../translations/pt/LC_MESSAGES/message.po | 4 +- .../pt_BR/LC_MESSAGES/messages.json | 4 +- .../pt_BR/LC_MESSAGES/messages.po | 8 +- .../translations/ru/LC_MESSAGES/messages.json | 2 +- .../translations/ru/LC_MESSAGES/messages.po | 4 +- .../translations/sl/LC_MESSAGES/messages.json | 4 +- .../translations/sl/LC_MESSAGES/messages.po | 8 +- .../translations/zh/LC_MESSAGES/messages.json | 4 +- .../translations/zh/LC_MESSAGES/messages.po | 8 +- superset/views/core.py | 4 +- superset/views/database/forms.py | 136 +++--------------- superset/views/database/mixins.py | 12 +- superset/views/database/validators.py | 6 +- superset/views/database/views.py | 8 +- tests/integration_tests/base_tests.py | 2 +- tests/integration_tests/core_tests.py | 2 +- tests/integration_tests/csv_upload_tests.py | 2 +- .../integration_tests/databases/api_tests.py | 12 +- .../databases/commands_tests.py | 16 +-- tests/integration_tests/fixtures/database.py | 2 +- .../fixtures/importexport.py | 2 +- tests/integration_tests/model_tests.py | 4 +- 53 files changed, 205 insertions(+), 251 deletions(-) create mode 100644 superset/migrations/versions/b92d69a6643c_rename_csv_to_file.py diff --git a/docs/src/pages/docs/installation/kubernetes.mdx b/docs/src/pages/docs/installation/kubernetes.mdx index bc6cc702fb964..5f249a28a69a7 100644 --- a/docs/src/pages/docs/installation/kubernetes.mdx +++ b/docs/src/pages/docs/installation/kubernetes.mdx @@ -185,12 +185,12 @@ Data source definitions can be automatically declared by providing key/value yam extraConfigs: datasources-init.yaml: | databases: - - allow_csv_upload: true + - allow_file_upload: true allow_ctas: true allow_cvas: true database_name: example-db extra: "{\r\n \"metadata_params\": {},\r\n \"engine_params\": {},\r\n \"\ - metadata_cache_timeout\": {},\r\n \"schemas_allowed_for_csv_upload\": []\r\n\ + metadata_cache_timeout\": {},\r\n \"schemas_allowed_for_file_upload\": []\r\n\ }" sqlalchemy_uri: example://example-db.local tables: [] diff --git a/helm/superset/Chart.yaml b/helm/superset/Chart.yaml index e3c6f4bb54ab4..0c5b6a15af601 100644 --- a/helm/superset/Chart.yaml +++ b/helm/superset/Chart.yaml @@ -22,7 +22,7 @@ maintainers: - name: craig-rueda email: craig@craigrueda.com url: https://github.com/craig-rueda -version: 0.3.10 +version: 0.3.11 dependencies: - name: postgresql version: 10.2.0 diff --git a/helm/superset/values.yaml b/helm/superset/values.yaml index a9b9e1558c085..72c515aa3a615 100644 --- a/helm/superset/values.yaml +++ b/helm/superset/values.yaml @@ -80,12 +80,12 @@ extraSecretEnv: {} extraConfigs: {} # datasources-init.yaml: | # databases: - # - allow_csv_upload: true + # - allow_file_upload: true # allow_ctas: true # allow_cvas: true # database_name: example-db # extra: "{\r\n \"metadata_params\": {},\r\n \"engine_params\": {},\r\n \"\ - # metadata_cache_timeout\": {},\r\n \"schemas_allowed_for_csv_upload\": []\r\n\ + # metadata_cache_timeout\": {},\r\n \"schemas_allowed_for_file_upload\": []\r\n\ # }" # sqlalchemy_uri: example://example-db.local # tables: [] diff --git a/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx b/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx index af3fa96109f66..e885bd7e1e831 100644 --- a/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx +++ b/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx @@ -66,7 +66,7 @@ beforeEach(() => { description_columns: {}, ids: [1, 2], label_columns: { - allow_csv_upload: 'Allow Csv Upload', + allow_file_upload: 'Allow Csv Upload', allow_ctas: 'Allow Ctas', allow_cvas: 'Allow Cvas', allow_dml: 'Allow Dml', @@ -88,7 +88,7 @@ beforeEach(() => { id: 'Id', }, list_columns: [ - 'allow_csv_upload', + 'allow_file_upload', 'allow_ctas', 'allow_cvas', 'allow_dml', @@ -110,7 +110,7 @@ beforeEach(() => { ], list_title: 'List Database', order_columns: [ - 'allow_csv_upload', + 'allow_file_upload', 'allow_dml', 'allow_run_async', 'changed_on', @@ -121,7 +121,7 @@ beforeEach(() => { ], result: [ { - allow_csv_upload: false, + allow_file_upload: false, allow_ctas: false, allow_cvas: false, allow_dml: false, diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseList.test.jsx b/superset-frontend/src/views/CRUD/data/database/DatabaseList.test.jsx index 815ae628fca06..6dbe4e596ec26 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseList.test.jsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseList.test.jsx @@ -54,7 +54,7 @@ const mockdatabases = [...new Array(3)].map((_, i) => ({ backend: 'postgresql', allow_run_async: true, allow_dml: false, - allow_csv_upload: true, + allow_file_upload: true, expose_in_sqllab: false, changed_on_delta_humanized: `${i} day(s) ago`, changed_on: new Date().toISOString, diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx index 8c83b7f5bf663..a60fa25d22736 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx @@ -267,13 +267,13 @@ function DatabaseList({ addDangerToast, addSuccessToast }: DatabaseListProps) { size: 'sm', }, { - accessor: 'allow_csv_upload', + accessor: 'allow_file_upload', Header: t('CSV upload'), Cell: ({ row: { - original: { allow_csv_upload: allowCSVUpload }, + original: { allow_file_upload: allowFileUpload }, }, - }: any) => , + }: any) => , size: 'md', }, { diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx index 632dcca35e67d..e1bd62ae777a1 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx @@ -371,9 +371,9 @@ const ExtraOptions = ({
diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx index c892816c3877e..5f0b810f4b2bf 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx @@ -237,12 +237,12 @@ function dbReducer( }, }; } - if (action.payload.name === 'schemas_allowed_for_csv_upload') { + if (action.payload.name === 'schemas_allowed_for_file_upload') { return { ...trimmedState, extra_json: { ...trimmedState.extra_json, - schemas_allowed_for_csv_upload: (action.payload.value || '').split( + schemas_allowed_for_file_upload: (action.payload.value || '').split( ',', ), }, @@ -346,8 +346,8 @@ function dbReducer( ...JSON.parse(action.payload.extra || ''), metadata_params: JSON.stringify(extra_json?.metadata_params), engine_params: JSON.stringify(extra_json?.engine_params), - schemas_allowed_for_csv_upload: - extra_json?.schemas_allowed_for_csv_upload, + schemas_allowed_for_file_upload: + extra_json?.schemas_allowed_for_file_upload, }; } @@ -412,8 +412,8 @@ const serializeExtra = (extraJson: DatabaseObject['extra_json']) => engine_params: JSON.parse( ((extraJson?.engine_params as unknown) as string) || '{}', ), - schemas_allowed_for_csv_upload: ( - extraJson?.schemas_allowed_for_csv_upload || [] + schemas_allowed_for_file_upload: ( + extraJson?.schemas_allowed_for_file_upload || [] ).filter(schema => schema !== ''), }); diff --git a/superset-frontend/src/views/CRUD/data/database/types.ts b/superset-frontend/src/views/CRUD/data/database/types.ts index 53dd6df8f70d2..4ffb69535cbe2 100644 --- a/superset-frontend/src/views/CRUD/data/database/types.ts +++ b/superset-frontend/src/views/CRUD/data/database/types.ts @@ -72,7 +72,7 @@ export type DatabaseObject = { // Security encrypted_extra?: string; server_cert?: string; - allow_csv_upload?: boolean; + allow_file_upload?: boolean; impersonate_user?: boolean; parameters_schema?: Record; @@ -87,7 +87,7 @@ export type DatabaseObject = { table_cache_timeout?: number; // in Performance }; // No field, holds schema and table timeout allows_virtual_table_explore?: boolean; // in SQL Lab - schemas_allowed_for_csv_upload?: string[]; // in Security + schemas_allowed_for_file_upload?: string[]; // in Security cancel_query_on_windows_unload?: boolean; // in Performance version?: string; diff --git a/superset/config.py b/superset/config.py index 711b1632e7cde..e7cae127e3e9d 100644 --- a/superset/config.py +++ b/superset/config.py @@ -863,7 +863,7 @@ def CSV_TO_HIVE_UPLOAD_DIRECTORY_FUNC( # pylint: disable=invalid-name UPLOADED_CSV_HIVE_NAMESPACE: Optional[str] = None # Function that computes the allowed schemas for the CSV uploads. -# Allowed schemas will be a union of schemas_allowed_for_csv_upload +# Allowed schemas will be a union of schemas_allowed_for_file_upload # db configuration and a result of this function. # mypy doesn't catch that if case ensures list content being always str diff --git a/superset/databases/api.py b/superset/databases/api.py index f095aaf8d1b3f..91290bc924b7c 100644 --- a/superset/databases/api.py +++ b/superset/databases/api.py @@ -104,7 +104,7 @@ class DatabaseRestApi(BaseSupersetModelRestApi): "cache_timeout", "expose_in_sqllab", "allow_run_async", - "allow_csv_upload", + "allow_file_upload", "configuration_method", "allow_ctas", "allow_cvas", @@ -121,7 +121,7 @@ class DatabaseRestApi(BaseSupersetModelRestApi): "sqlalchemy_uri", ] list_columns = [ - "allow_csv_upload", + "allow_file_upload", "allow_ctas", "allow_cvas", "allow_dml", @@ -148,7 +148,7 @@ class DatabaseRestApi(BaseSupersetModelRestApi): "cache_timeout", "expose_in_sqllab", "allow_run_async", - "allow_csv_upload", + "allow_file_upload", "allow_ctas", "allow_cvas", "allow_dml", @@ -164,7 +164,7 @@ class DatabaseRestApi(BaseSupersetModelRestApi): list_select_columns = list_columns + ["extra", "sqlalchemy_uri", "password"] order_columns = [ - "allow_csv_upload", + "allow_file_upload", "allow_dml", "allow_run_async", "changed_on", diff --git a/superset/databases/commands/export.py b/superset/databases/commands/export.py index 786eb56a0ca1d..53cbe67d22512 100644 --- a/superset/databases/commands/export.py +++ b/superset/databases/commands/export.py @@ -39,11 +39,11 @@ def parse_extra(extra_payload: str) -> Dict[str, Any]: logger.info("Unable to decode `extra` field: %s", extra_payload) return {} - # Fix for DBs saved with an invalid ``schemas_allowed_for_csv_upload`` - schemas_allowed_for_csv_upload = extra.get("schemas_allowed_for_csv_upload") - if isinstance(schemas_allowed_for_csv_upload, str): - extra["schemas_allowed_for_csv_upload"] = json.loads( - schemas_allowed_for_csv_upload + # Fix for DBs saved with an invalid ``schemas_allowed_for_file_upload`` + schemas_allowed_for_file_upload = extra.get("schemas_allowed_for_file_upload") + if isinstance(schemas_allowed_for_file_upload, str): + extra["schemas_allowed_for_file_upload"] = json.loads( + schemas_allowed_for_file_upload ) return extra diff --git a/superset/databases/schemas.py b/superset/databases/schemas.py index 763e7db167c8e..20a06457a9c3b 100644 --- a/superset/databases/schemas.py +++ b/superset/databases/schemas.py @@ -54,7 +54,7 @@ "as a results backend. Refer to the installation docs " "for more information." ) -allow_csv_upload_description = ( +allow_file_upload_description = ( "Allow to upload CSV file data into this database" "If selected, please set the schemas allowed for csv upload in Extra." ) @@ -108,9 +108,9 @@ '"table_cache_timeout": 600}**. ' "If unset, cache will not be enabled for the functionality. " "A timeout of 0 indicates that the cache never expires.
" - "3. The ``schemas_allowed_for_csv_upload`` is a comma separated list " + "3. The ``schemas_allowed_for_file_upload`` is a comma separated list " "of schemas that CSVs are allowed to upload to. " - 'Specify it as **"schemas_allowed_for_csv_upload": ' + 'Specify it as **"schemas_allowed_for_file_upload": ' '["public", "csv_upload"]**. ' "If database flavor does not support schema or any schema is allowed " "to be accessed, just leave the list empty
" @@ -355,7 +355,7 @@ class Meta: # pylint: disable=too-few-public-methods ) expose_in_sqllab = fields.Boolean(description=expose_in_sqllab_description) allow_run_async = fields.Boolean(description=allow_run_async_description) - allow_csv_upload = fields.Boolean(description=allow_csv_upload_description) + allow_file_upload = fields.Boolean(description=allow_file_upload_description) allow_ctas = fields.Boolean(description=allow_ctas_description) allow_cvas = fields.Boolean(description=allow_cvas_description) allow_dml = fields.Boolean(description=allow_dml_description) @@ -397,7 +397,7 @@ class Meta: # pylint: disable=too-few-public-methods ) expose_in_sqllab = fields.Boolean(description=expose_in_sqllab_description) allow_run_async = fields.Boolean(description=allow_run_async_description) - allow_csv_upload = fields.Boolean(description=allow_csv_upload_description) + allow_file_upload = fields.Boolean(description=allow_file_upload_description) allow_ctas = fields.Boolean(description=allow_ctas_description) allow_cvas = fields.Boolean(description=allow_cvas_description) allow_dml = fields.Boolean(description=allow_dml_description) @@ -558,15 +558,15 @@ def fix_schemas_allowed_for_csv_upload( self, data: Dict[str, Any], **kwargs: Any ) -> Dict[str, Any]: """ - Fix ``schemas_allowed_for_csv_upload`` being a string. + Fix ``schemas_allowed_for_file_upload`` being a string. Due to a bug in the database modal, some databases might have been - saved and exported with a string for ``schemas_allowed_for_csv_upload``. + saved and exported with a string for ``schemas_allowed_for_file_upload``. """ - schemas_allowed_for_csv_upload = data.get("schemas_allowed_for_csv_upload") - if isinstance(schemas_allowed_for_csv_upload, str): - data["schemas_allowed_for_csv_upload"] = json.loads( - schemas_allowed_for_csv_upload + schemas_allowed_for_file_upload = data.get("schemas_allowed_for_file_upload") + if isinstance(schemas_allowed_for_file_upload, str): + data["schemas_allowed_for_file_upload"] = json.loads( + schemas_allowed_for_file_upload ) return data @@ -574,7 +574,7 @@ def fix_schemas_allowed_for_csv_upload( metadata_params = fields.Dict(keys=fields.Str(), values=fields.Raw()) engine_params = fields.Dict(keys=fields.Str(), values=fields.Raw()) metadata_cache_timeout = fields.Dict(keys=fields.Str(), values=fields.Integer()) - schemas_allowed_for_csv_upload = fields.List(fields.String()) + schemas_allowed_for_file_upload = fields.List(fields.String()) cost_estimate_enabled = fields.Boolean() @@ -587,7 +587,7 @@ class ImportV1DatabaseSchema(Schema): allow_run_async = fields.Boolean() allow_ctas = fields.Boolean() allow_cvas = fields.Boolean() - allow_csv_upload = fields.Boolean() + allow_file_upload = fields.Boolean() extra = fields.Nested(ImportV1DatabaseExtraSchema) uuid = fields.UUID(required=True) version = fields.String(required=True) diff --git a/superset/migrations/versions/b92d69a6643c_rename_csv_to_file.py b/superset/migrations/versions/b92d69a6643c_rename_csv_to_file.py new file mode 100644 index 0000000000000..dc02103337c05 --- /dev/null +++ b/superset/migrations/versions/b92d69a6643c_rename_csv_to_file.py @@ -0,0 +1,48 @@ +# 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. +"""rename_csv_to_file + +Revision ID: b92d69a6643c +Revises: 32646df09c64 +Create Date: 2021-09-19 14:42:20.130368 + +""" + +# revision identifiers, used by Alembic. +revision = "b92d69a6643c" +down_revision = "32646df09c64" + +import sqlalchemy as sa +from alembic import op + + +def upgrade(): + with op.batch_alter_table("dbs") as batch_op: + batch_op.alter_column( + "allow_csv_upload", + new_column_name="allow_file_upload", + existing_type=sa.Boolean(), + ) + + +def downgrade(): + with op.batch_alter_table("dbs") as batch_op: + batch_op.alter_column( + "allow_file_upload", + new_column_name="allow_csv_upload", + existing_type=sa.Boolean(), + ) diff --git a/superset/models/core.py b/superset/models/core.py index d4e78503d1d09..3aaa35769bd27 100755 --- a/superset/models/core.py +++ b/superset/models/core.py @@ -129,7 +129,7 @@ class Database( String(255), server_default=ConfigurationMethod.SQLALCHEMY_FORM.value ) allow_run_async = Column(Boolean, default=False) - allow_csv_upload = Column(Boolean, default=False) + allow_file_upload = Column(Boolean, default=False) allow_ctas = Column(Boolean, default=False) allow_cvas = Column(Boolean, default=False) allow_dml = Column(Boolean, default=False) @@ -145,7 +145,7 @@ class Database( "metadata_params": {}, "engine_params": {}, "metadata_cache_timeout": {}, - "schemas_allowed_for_csv_upload": [] + "schemas_allowed_for_file_upload": [] } """ ), @@ -161,7 +161,7 @@ class Database( "allow_run_async", "allow_ctas", "allow_cvas", - "allow_csv_upload", + "allow_file_upload", "extra", ] extra_import_fields = ["password"] @@ -679,10 +679,10 @@ def get_foreign_keys( ) -> List[Dict[str, Any]]: return self.inspector.get_foreign_keys(table_name, schema) - def get_schema_access_for_csv_upload( # pylint: disable=invalid-name + def get_schema_access_for_file_upload( # pylint: disable=invalid-name self, ) -> List[str]: - allowed_databases = self.get_extra().get("schemas_allowed_for_csv_upload", []) + allowed_databases = self.get_extra().get("schemas_allowed_for_file_upload", []) if isinstance(allowed_databases, str): allowed_databases = literal_eval(allowed_databases) diff --git a/superset/translations/de/LC_MESSAGES/messages.json b/superset/translations/de/LC_MESSAGES/messages.json index fda247c2f9c84..092fcdb2d2117 100644 --- a/superset/translations/de/LC_MESSAGES/messages.json +++ b/superset/translations/de/LC_MESSAGES/messages.json @@ -2016,7 +2016,7 @@ "2. The metadata_cache_timeout is a cache timeout setting in seconds for metadata fetch of this database. Specify it as \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. If unset, cache will not be enabled for the functionality. A timeout of 0 indicates that the cache never expires.": [ "" ], - "3. The schemas_allowed_for_csv_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ + "3. The schemas_allowed_for_file_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ "" ], "4. The version field is a string specifying this db's version. This should be used with Presto DBs so that the syntax is correct.": [ diff --git a/superset/translations/de/LC_MESSAGES/messages.po b/superset/translations/de/LC_MESSAGES/messages.po index 9eaa43d8cafc6..368876e5af940 100644 --- a/superset/translations/de/LC_MESSAGES/messages.po +++ b/superset/translations/de/LC_MESSAGES/messages.po @@ -7324,9 +7324,9 @@ msgstr "" #: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx:669 msgid "" -"3. The schemas_allowed_for_csv_upload is a comma separated list of schemas " +"3. The schemas_allowed_for_file_upload is a comma separated list of schemas " "that CSVs are allowed to upload to. Specify it as " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If " "database flavor does not support schema or any schema is allowed to be " "accessed, just leave the list empty." msgstr "" diff --git a/superset/translations/en/LC_MESSAGES/messages.json b/superset/translations/en/LC_MESSAGES/messages.json index 2c6dfa3de8989..ec99be74a07cb 100644 --- a/superset/translations/en/LC_MESSAGES/messages.json +++ b/superset/translations/en/LC_MESSAGES/messages.json @@ -1922,7 +1922,7 @@ "2. The metadata_cache_timeout is a cache timeout setting in seconds for metadata fetch of this database. Specify it as \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. If unset, cache will not be enabled for the functionality. A timeout of 0 indicates that the cache never expires.": [ "" ], - "3. The schemas_allowed_for_csv_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ + "3. The schemas_allowed_for_file_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ "" ], "4. The version field is a string specifying this db's version. This should be used with Presto DBs so that the syntax is correct.": [ diff --git a/superset/translations/en/LC_MESSAGES/messages.po b/superset/translations/en/LC_MESSAGES/messages.po index 5237f0507b712..d3014fefe46f9 100644 --- a/superset/translations/en/LC_MESSAGES/messages.po +++ b/superset/translations/en/LC_MESSAGES/messages.po @@ -7323,9 +7323,9 @@ msgstr "" #: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx:669 msgid "" -"3. The schemas_allowed_for_csv_upload is a comma separated list of schemas " +"3. The schemas_allowed_for_file_upload is a comma separated list of schemas " "that CSVs are allowed to upload to. Specify it as " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If " "database flavor does not support schema or any schema is allowed to be " "accessed, just leave the list empty." msgstr "" diff --git a/superset/translations/es/LC_MESSAGES/messages.json b/superset/translations/es/LC_MESSAGES/messages.json index 3789e444858d9..070da628b3d0d 100644 --- a/superset/translations/es/LC_MESSAGES/messages.json +++ b/superset/translations/es/LC_MESSAGES/messages.json @@ -2181,7 +2181,7 @@ "2. The metadata_cache_timeout is a cache timeout setting in seconds for metadata fetch of this database. Specify it as \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. If unset, cache will not be enabled for the functionality. A timeout of 0 indicates that the cache never expires.": [ "" ], - "3. The schemas_allowed_for_csv_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ + "3. The schemas_allowed_for_file_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ "" ], "4. The version field is a string specifying this db's version. This should be used with Presto DBs so that the syntax is correct.": [ diff --git a/superset/translations/es/LC_MESSAGES/messages.po b/superset/translations/es/LC_MESSAGES/messages.po index 9d9a94e8f6dd0..37a08de605fbf 100644 --- a/superset/translations/es/LC_MESSAGES/messages.po +++ b/superset/translations/es/LC_MESSAGES/messages.po @@ -7411,9 +7411,9 @@ msgstr "" #: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx:669 msgid "" -"3. The schemas_allowed_for_csv_upload is a comma separated list of schemas " +"3. The schemas_allowed_for_file_upload is a comma separated list of schemas " "that CSVs are allowed to upload to. Specify it as " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If " "database flavor does not support schema or any schema is allowed to be " "accessed, just leave the list empty." msgstr "" diff --git a/superset/translations/fr/LC_MESSAGES/messages.json b/superset/translations/fr/LC_MESSAGES/messages.json index 1756548a9abdb..44a47dc0d7e0c 100644 --- a/superset/translations/fr/LC_MESSAGES/messages.json +++ b/superset/translations/fr/LC_MESSAGES/messages.json @@ -2305,7 +2305,7 @@ "2. The metadata_cache_timeout is a cache timeout setting in seconds for metadata fetch of this database. Specify it as \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. If unset, cache will not be enabled for the functionality. A timeout of 0 indicates that the cache never expires.": [ "" ], - "3. The schemas_allowed_for_csv_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ + "3. The schemas_allowed_for_file_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ "" ], "4. The version field is a string specifying this db's version. This should be used with Presto DBs so that the syntax is correct.": [ diff --git a/superset/translations/fr/LC_MESSAGES/messages.po b/superset/translations/fr/LC_MESSAGES/messages.po index 2f1f84e6ffee7..ca57acdbef01d 100644 --- a/superset/translations/fr/LC_MESSAGES/messages.po +++ b/superset/translations/fr/LC_MESSAGES/messages.po @@ -7504,9 +7504,9 @@ msgstr "" #: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx:669 msgid "" -"3. The schemas_allowed_for_csv_upload is a comma separated list of schemas " +"3. The schemas_allowed_for_file_upload is a comma separated list of schemas " "that CSVs are allowed to upload to. Specify it as " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If " "database flavor does not support schema or any schema is allowed to be " "accessed, just leave the list empty." msgstr "" diff --git a/superset/translations/it/LC_MESSAGES/messages.json b/superset/translations/it/LC_MESSAGES/messages.json index 025b06f977f3e..9242089d9db63 100644 --- a/superset/translations/it/LC_MESSAGES/messages.json +++ b/superset/translations/it/LC_MESSAGES/messages.json @@ -2053,7 +2053,7 @@ "2. The metadata_cache_timeout is a cache timeout setting in seconds for metadata fetch of this database. Specify it as \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. If unset, cache will not be enabled for the functionality. A timeout of 0 indicates that the cache never expires.": [ "" ], - "3. The schemas_allowed_for_csv_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ + "3. The schemas_allowed_for_file_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ "" ], "4. The version field is a string specifying this db's version. This should be used with Presto DBs so that the syntax is correct.": [ diff --git a/superset/translations/it/LC_MESSAGES/messages.po b/superset/translations/it/LC_MESSAGES/messages.po index 9a9cbac6c7862..7c2741b5c94ab 100644 --- a/superset/translations/it/LC_MESSAGES/messages.po +++ b/superset/translations/it/LC_MESSAGES/messages.po @@ -7372,9 +7372,9 @@ msgstr "" #: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx:669 msgid "" -"3. The schemas_allowed_for_csv_upload is a comma separated list of schemas " +"3. The schemas_allowed_for_file_upload is a comma separated list of schemas " "that CSVs are allowed to upload to. Specify it as " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If " "database flavor does not support schema or any schema is allowed to be " "accessed, just leave the list empty." msgstr "" diff --git a/superset/translations/ja/LC_MESSAGES/messages.json b/superset/translations/ja/LC_MESSAGES/messages.json index 9275f6b5a43b9..38a3e99270055 100644 --- a/superset/translations/ja/LC_MESSAGES/messages.json +++ b/superset/translations/ja/LC_MESSAGES/messages.json @@ -2411,7 +2411,7 @@ "2. The metadata_cache_timeout is a cache timeout setting in seconds for metadata fetch of this database. Specify it as \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. If unset, cache will not be enabled for the functionality. A timeout of 0 indicates that the cache never expires.": [ "" ], - "3. The schemas_allowed_for_csv_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ + "3. The schemas_allowed_for_file_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ "" ], "4. The version field is a string specifying this db's version. This should be used with Presto DBs so that the syntax is correct.": [ diff --git a/superset/translations/ja/LC_MESSAGES/messages.po b/superset/translations/ja/LC_MESSAGES/messages.po index 6a594ce5915f2..39d6e5e95e3cc 100644 --- a/superset/translations/ja/LC_MESSAGES/messages.po +++ b/superset/translations/ja/LC_MESSAGES/messages.po @@ -8050,9 +8050,9 @@ msgstr "" #: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx:632 msgid "" -"3. The schemas_allowed_for_csv_upload is a comma separated list of " +"3. The schemas_allowed_for_file_upload is a comma separated list of " "schemas that CSVs are allowed to upload to. Specify it as " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If " "database flavor does not support schema or any schema is allowed to be " "accessed, just leave the list empty." msgstr "" diff --git a/superset/translations/ko/LC_MESSAGES/messages.json b/superset/translations/ko/LC_MESSAGES/messages.json index 2ae5e9e8ab4b7..2ff6203ddc110 100644 --- a/superset/translations/ko/LC_MESSAGES/messages.json +++ b/superset/translations/ko/LC_MESSAGES/messages.json @@ -2108,7 +2108,7 @@ "2. The metadata_cache_timeout is a cache timeout setting in seconds for metadata fetch of this database. Specify it as \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. If unset, cache will not be enabled for the functionality. A timeout of 0 indicates that the cache never expires.": [ "" ], - "3. The schemas_allowed_for_csv_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ + "3. The schemas_allowed_for_file_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ "" ], "4. The version field is a string specifying this db's version. This should be used with Presto DBs so that the syntax is correct.": [ diff --git a/superset/translations/ko/LC_MESSAGES/messages.po b/superset/translations/ko/LC_MESSAGES/messages.po index 3c0a054f89c3e..3287f07927b8a 100644 --- a/superset/translations/ko/LC_MESSAGES/messages.po +++ b/superset/translations/ko/LC_MESSAGES/messages.po @@ -7831,9 +7831,9 @@ msgstr "" #: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx:652 msgid "" -"3. The schemas_allowed_for_csv_upload is a comma separated list of " +"3. The schemas_allowed_for_file_upload is a comma separated list of " "schemas that CSVs are allowed to upload to. Specify it as " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If " "database flavor does not support schema or any schema is allowed to be " "accessed, just leave the list empty." msgstr "" diff --git a/superset/translations/messages.pot b/superset/translations/messages.pot index 9365d5058b7f5..9d149a93aa5b4 100644 --- a/superset/translations/messages.pot +++ b/superset/translations/messages.pot @@ -8050,9 +8050,9 @@ msgstr "" #: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx:632 msgid "" -"3. The schemas_allowed_for_csv_upload is a comma separated list of " +"3. The schemas_allowed_for_file_upload is a comma separated list of " "schemas that CSVs are allowed to upload to. Specify it as " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If " "database flavor does not support schema or any schema is allowed to be " "accessed, just leave the list empty." msgstr "" diff --git a/superset/translations/pt/LC_MESSAGES/message.json b/superset/translations/pt/LC_MESSAGES/message.json index 4ac7dd8411971..272ae85934a64 100644 --- a/superset/translations/pt/LC_MESSAGES/message.json +++ b/superset/translations/pt/LC_MESSAGES/message.json @@ -2201,7 +2201,7 @@ "2. The metadata_cache_timeout is a cache timeout setting in seconds for metadata fetch of this database. Specify it as \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. If unset, cache will not be enabled for the functionality. A timeout of 0 indicates that the cache never expires.": [ "" ], - "3. The schemas_allowed_for_csv_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ + "3. The schemas_allowed_for_file_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ "" ], "4. The version field is a string specifying this db's version. This should be used with Presto DBs so that the syntax is correct.": [ diff --git a/superset/translations/pt/LC_MESSAGES/message.po b/superset/translations/pt/LC_MESSAGES/message.po index c05e5ceb10a5b..8e56cac5eab91 100644 --- a/superset/translations/pt/LC_MESSAGES/message.po +++ b/superset/translations/pt/LC_MESSAGES/message.po @@ -7378,9 +7378,9 @@ msgstr "" #: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx:669 msgid "" -"3. The schemas_allowed_for_csv_upload is a comma separated list of schemas " +"3. The schemas_allowed_for_file_upload is a comma separated list of schemas " "that CSVs are allowed to upload to. Specify it as " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If " "database flavor does not support schema or any schema is allowed to be " "accessed, just leave the list empty." msgstr "" diff --git a/superset/translations/pt_BR/LC_MESSAGES/messages.json b/superset/translations/pt_BR/LC_MESSAGES/messages.json index c492e211a6bd8..b1edce97e6978 100644 --- a/superset/translations/pt_BR/LC_MESSAGES/messages.json +++ b/superset/translations/pt_BR/LC_MESSAGES/messages.json @@ -2660,8 +2660,8 @@ "2. The metadata_cache_timeout is a cache timeout setting in seconds for metadata fetch of this database. Specify it as \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. If unset, cache will not be enabled for the functionality. A timeout of 0 indicates that the cache never expires.": [ "2. O metadata_cache_timeout é uma configuração de limite de tempo do cache em segundos para a busca dos metadados deste banco de dados. Especifique como \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. Se não configurado, o cache não será habilitado para a funcionalidade. Um limite de tempo de 0 indica que o cache nunca expira." ], - "3. The schemas_allowed_for_csv_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ - "3. O schemas_allowed_for_csv_upload é uma lista de esquemas separada por vírgula nos quais é permitida a carga de CSVs. Especifique como \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. Se o banco de dados não suporta esquema ou a carga é permitida em qualque esquema, apenas deixe a lista vazia." + "3. The schemas_allowed_for_file_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ + "3. O schemas_allowed_for_file_upload é uma lista de esquemas separada por vírgula nos quais é permitida a carga de CSVs. Especifique como \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. Se o banco de dados não suporta esquema ou a carga é permitida em qualque esquema, apenas deixe a lista vazia." ], "4. The version field is a string specifying this db's version. This should be used with Presto DBs so that the syntax is correct.": [ "4. O campo de versão é um texto especificando a versão do banco de dados. Isto deve ser utilizado com os bancos de dados Presto para garantir que a sintaxe esteja correta." diff --git a/superset/translations/pt_BR/LC_MESSAGES/messages.po b/superset/translations/pt_BR/LC_MESSAGES/messages.po index 223c8a0051bc6..6a6bc21247049 100644 --- a/superset/translations/pt_BR/LC_MESSAGES/messages.po +++ b/superset/translations/pt_BR/LC_MESSAGES/messages.po @@ -7817,15 +7817,15 @@ msgstr "" #: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx:669 msgid "" -"3. The schemas_allowed_for_csv_upload is a comma separated list of schemas " +"3. The schemas_allowed_for_file_upload is a comma separated list of schemas " "that CSVs are allowed to upload to. Specify it as " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If " "database flavor does not support schema or any schema is allowed to be " "accessed, just leave the list empty." msgstr "" -"3. O schemas_allowed_for_csv_upload é uma lista de esquemas separada por " +"3. O schemas_allowed_for_file_upload é uma lista de esquemas separada por " "vírgula nos quais é permitida a carga de CSVs. Especifique como " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. Se o banco " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. Se o banco " "de dados não suporta esquema ou a carga é permitida em qualque esquema, " "apenas deixe a lista vazia." diff --git a/superset/translations/ru/LC_MESSAGES/messages.json b/superset/translations/ru/LC_MESSAGES/messages.json index 066fd879f51b9..9e64f9dfe14a7 100644 --- a/superset/translations/ru/LC_MESSAGES/messages.json +++ b/superset/translations/ru/LC_MESSAGES/messages.json @@ -2536,7 +2536,7 @@ "2. The metadata_cache_timeout is a cache timeout setting in seconds for metadata fetch of this database. Specify it as \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. If unset, cache will not be enabled for the functionality. A timeout of 0 indicates that the cache never expires.": [ "" ], - "3. The schemas_allowed_for_csv_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ + "3. The schemas_allowed_for_file_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ "" ], "4. The version field is a string specifying this db's version. This should be used with Presto DBs so that the syntax is correct.": [ diff --git a/superset/translations/ru/LC_MESSAGES/messages.po b/superset/translations/ru/LC_MESSAGES/messages.po index 095db8fad4744..a49ca4ea19faa 100644 --- a/superset/translations/ru/LC_MESSAGES/messages.po +++ b/superset/translations/ru/LC_MESSAGES/messages.po @@ -7649,9 +7649,9 @@ msgstr "" #: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx:669 msgid "" -"3. The schemas_allowed_for_csv_upload is a comma separated list of schemas " +"3. The schemas_allowed_for_file_upload is a comma separated list of schemas " "that CSVs are allowed to upload to. Specify it as " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If " "database flavor does not support schema or any schema is allowed to be " "accessed, just leave the list empty." msgstr "" diff --git a/superset/translations/sl/LC_MESSAGES/messages.json b/superset/translations/sl/LC_MESSAGES/messages.json index 78d9805dba87f..47f702710546d 100644 --- a/superset/translations/sl/LC_MESSAGES/messages.json +++ b/superset/translations/sl/LC_MESSAGES/messages.json @@ -3073,8 +3073,8 @@ "2. The metadata_cache_timeout is a cache timeout setting in seconds for metadata fetch of this database. Specify it as \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. If unset, cache will not be enabled for the functionality. A timeout of 0 indicates that the cache never expires.": [ "2. metadata_cache_timeout je trajanje predpomnilnik v sekundah za pridobivanje metapodatkov za to podatkovno bazo. Definirajte ga kot \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. Če ni definirano, predpomnilnik ne bo omogčen pri tej funkciji. Trajanje 0 določa, da se predpomnilnik ne izteče." ], - "3. The schemas_allowed_for_csv_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ - "3. schemas_allowed_for_csv_upload je z vejicami ločen seznam shem, ki jih je dovoljeno nalagati s CSV-ji. Definirajte ga kot \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. Če tip podatkovne baza ne podpira sheme ali pa je dovoljen dostop do vseh shem, pustite seznam prazen." + "3. The schemas_allowed_for_file_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ + "3. schemas_allowed_for_file_upload je z vejicami ločen seznam shem, ki jih je dovoljeno nalagati s CSV-ji. Definirajte ga kot \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. Če tip podatkovne baza ne podpira sheme ali pa je dovoljen dostop do vseh shem, pustite seznam prazen." ], "4. The version field is a string specifying this db's version. This should be used with Presto DBs so that the syntax is correct.": [ "4. Polje \"version\" je znakovni niz, ki določa verzijo podatkovne baze. Uporabljeno mora biti s Presto bazo, da je sintaksa pravilna." diff --git a/superset/translations/sl/LC_MESSAGES/messages.po b/superset/translations/sl/LC_MESSAGES/messages.po index 2aba536662e6d..80b3f3f0534d3 100644 --- a/superset/translations/sl/LC_MESSAGES/messages.po +++ b/superset/translations/sl/LC_MESSAGES/messages.po @@ -9289,15 +9289,15 @@ msgstr "" #: superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx:360 msgid "" -"3. The schemas_allowed_for_csv_upload is a comma separated list of schemas " +"3. The schemas_allowed_for_file_upload is a comma separated list of schemas " "that CSVs are allowed to upload to. Specify it as " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If " "database flavor does not support schema or any schema is allowed to be " "accessed, just leave the list empty." msgstr "" -"3. schemas_allowed_for_csv_upload je z vejicami ločen seznam shem, ki jih je " +"3. schemas_allowed_for_file_upload je z vejicami ločen seznam shem, ki jih je " "dovoljeno nalagati s CSV-ji. Definirajte ga kot " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. Če tip " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. Če tip " "podatkovne baza ne podpira sheme ali pa je dovoljen dostop do vseh shem, " "pustite seznam prazen." diff --git a/superset/translations/zh/LC_MESSAGES/messages.json b/superset/translations/zh/LC_MESSAGES/messages.json index f2ad3aa1d174c..7245e11d5cc79 100644 --- a/superset/translations/zh/LC_MESSAGES/messages.json +++ b/superset/translations/zh/LC_MESSAGES/messages.json @@ -2299,8 +2299,8 @@ "2. The metadata_cache_timeout is a cache timeout setting in seconds for metadata fetch of this database. Specify it as \"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}. If unset, cache will not be enabled for the functionality. A timeout of 0 indicates that the cache never expires.": [ "2. metadata_cache_timeout 是获取该数据库元数据的缓存超时设置(秒)。可以这样进行设置:\"metadata_cache_timeout\": {\"schema_cache_timeout\": 600, \"table_cache_timeout\": 600}。如果未设置,则不会为该功能启用缓存。如果超时时间设置为0,则表示缓存永不过期。" ], - "3. The schemas_allowed_for_csv_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ - "3. schemas_allowed_for_csv_upload 是CSV文件允许上传的schema,该结构以逗号进行分割。 可以这样进行设置:\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]。如果数据库风格不支持schema或任何schema都被允许,请将列表留空。" + "3. The schemas_allowed_for_file_upload is a comma separated list of schemas that CSVs are allowed to upload to. Specify it as \"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If database flavor does not support schema or any schema is allowed to be accessed, just leave the list empty.": [ + "3. schemas_allowed_for_file_upload 是CSV文件允许上传的schema,该结构以逗号进行分割。 可以这样进行设置:\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]。如果数据库风格不支持schema或任何schema都被允许,请将列表留空。" ], "4. The version field is a string specifying this db's version. This should be used with Presto DBs so that the syntax is correct.": [ "4. version 字段是指定此数据库版本的字符串。这应该与Presto DBs一起使用,以便语法正确。" diff --git a/superset/translations/zh/LC_MESSAGES/messages.po b/superset/translations/zh/LC_MESSAGES/messages.po index bfda8ecfe9c11..5108e35438fa9 100644 --- a/superset/translations/zh/LC_MESSAGES/messages.po +++ b/superset/translations/zh/LC_MESSAGES/messages.po @@ -7464,13 +7464,13 @@ msgstr "2. metadata_cache_timeout 是获取该数据库元数据的缓存超时 #: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx:669 msgid "" -"3. The schemas_allowed_for_csv_upload is a comma separated list of schemas " +"3. The schemas_allowed_for_file_upload is a comma separated list of schemas " "that CSVs are allowed to upload to. Specify it as " -"\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]. If " +"\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]. If " "database flavor does not support schema or any schema is allowed to be " "accessed, just leave the list empty." -msgstr "3. schemas_allowed_for_csv_upload 是CSV文件允许上传的schema,该结构以逗号进行分割。 " -"可以这样进行设置:\"schemas_allowed_for_csv_upload\": [\"public\", \"csv_upload\"]。" +msgstr "3. schemas_allowed_for_file_upload 是CSV文件允许上传的schema,该结构以逗号进行分割。 " +"可以这样进行设置:\"schemas_allowed_for_file_upload\": [\"public\", \"csv_upload\"]。" "如果数据库风格不支持schema或任何schema都被允许,请将列表留空。" #: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx:678 diff --git a/superset/views/core.py b/superset/views/core.py index 5a7dd18f94153..e262ab7425364 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -164,7 +164,7 @@ logger = logging.getLogger(__name__) DATABASE_KEYS = [ - "allow_csv_upload", + "allow_file_upload", "allow_ctas", "allow_cvas", "allow_dml", @@ -2875,7 +2875,7 @@ def schemas_access_for_file_upload(self) -> FlaskResponse: db_id = int(request.args["db_id"]) database = db.session.query(Database).filter_by(id=db_id).one() try: - schemas_allowed = database.get_schema_access_for_csv_upload() + schemas_allowed = database.get_schema_access_for_file_upload() if security_manager.can_access_database(database): return self.json_response(schemas_allowed) # the list schemas_allowed should not be empty here diff --git a/superset/views/database/forms.py b/superset/views/database/forms.py index 1e391bc9c1e18..354cf4203e308 100644 --- a/superset/views/database/forms.py +++ b/superset/views/database/forms.py @@ -42,53 +42,55 @@ config = app.config -class CsvToDatabaseForm(DynamicForm): +class UploadToDatabaseForm(DynamicForm): # pylint: disable=E0211 - def csv_allowed_dbs() -> List[Database]: # type: ignore - csv_enabled_dbs = ( - db.session.query(Database).filter_by(allow_csv_upload=True).all() + def file_allowed_dbs() -> List[Database]: # type: ignore + file_enabled_dbs = ( + db.session.query(Database).filter_by(allow_file_upload=True).all() ) return [ - csv_enabled_db - for csv_enabled_db in csv_enabled_dbs - if CsvToDatabaseForm.at_least_one_schema_is_allowed(csv_enabled_db) + file_enabled_db + for file_enabled_db in file_enabled_dbs + if UploadToDatabaseForm.at_least_one_schema_is_allowed(file_enabled_db) ] @staticmethod def at_least_one_schema_is_allowed(database: Database) -> bool: """ If the user has access to the database or all datasource - 1. if schemas_allowed_for_csv_upload is empty + 1. if schemas_allowed_for_file_upload is empty a) if database does not support schema user is able to upload csv without specifying schema name b) if database supports schema user is able to upload csv to any schema - 2. if schemas_allowed_for_csv_upload is not empty + 2. if schemas_allowed_for_file_upload is not empty a) if database does not support schema This situation is impossible and upload will fail b) if database supports schema - user is able to upload to schema in schemas_allowed_for_csv_upload + user is able to upload to schema in schemas_allowed_for_file_upload elif the user does not access to the database or all datasource - 1. if schemas_allowed_for_csv_upload is empty + 1. if schemas_allowed_for_file_upload is empty a) if database does not support schema user is unable to upload csv b) if database supports schema user is unable to upload csv - 2. if schemas_allowed_for_csv_upload is not empty + 2. if schemas_allowed_for_file_upload is not empty a) if database does not support schema This situation is impossible and user is unable to upload csv b) if database supports schema - user is able to upload to schema in schemas_allowed_for_csv_upload + user is able to upload to schema in schemas_allowed_for_file_upload """ if security_manager.can_access_database(database): return True - schemas = database.get_schema_access_for_csv_upload() + schemas = database.get_schema_access_for_file_upload() if schemas and security_manager.get_schemas_accessible_by_user( database, schemas, False ): return True return False + +class CsvToDatabaseForm(UploadToDatabaseForm): name = StringField( _("Table Name"), description=_("Name of table to be created from csv data."), @@ -116,7 +118,7 @@ def at_least_one_schema_is_allowed(database: Database) -> bool: ) con = QuerySelectField( _("Database"), - query_factory=csv_allowed_dbs, + query_factory=UploadToDatabaseForm.file_allowed_dbs, get_pk=lambda a: a.id, get_label=lambda a: a.database_name, ) @@ -239,54 +241,7 @@ def at_least_one_schema_is_allowed(database: Database) -> bool: ) -class ExcelToDatabaseForm(DynamicForm): - # pylint: disable=E0211 - def excel_allowed_dbs() -> List[Database]: # type: ignore - # TODO: change allow_csv_upload to allow_file_upload - excel_enabled_dbs = ( - db.session.query(Database).filter_by(allow_csv_upload=True).all() - ) - return [ - excel_enabled_db - for excel_enabled_db in excel_enabled_dbs - if ExcelToDatabaseForm.at_least_one_schema_is_allowed(excel_enabled_db) - ] - - @staticmethod - def at_least_one_schema_is_allowed(database: Database) -> bool: - """ - If the user has access to the database or all datasource - 1. if schemas_allowed_for_csv_upload is empty - a) if database does not support schema - user is able to upload excel without specifying schema name - b) if database supports schema - user is able to upload excel to any schema - 2. if schemas_allowed_for_csv_upload is not empty - a) if database does not support schema - This situation is impossible and upload will fail - b) if database supports schema - user is able to upload to schema in schemas_allowed_for_csv_upload - elif the user does not access to the database or all datasource - 1. if schemas_allowed_for_csv_upload is empty - a) if database does not support schema - user is unable to upload excel - b) if database supports schema - user is unable to upload excel - 2. if schemas_allowed_for_csv_upload is not empty - a) if database does not support schema - This situation is impossible and user is unable to upload excel - b) if database supports schema - user is able to upload to schema in schemas_allowed_for_csv_upload - """ - if security_manager.can_access_database(database): - return True - schemas = database.get_schema_access_for_csv_upload() - if schemas and security_manager.schemas_accessible_by_user( - database, schemas, False - ): - return True - return False - +class ExcelToDatabaseForm(UploadToDatabaseForm): name = StringField( _("Table Name"), description=_("Name of table to be created from excel data."), @@ -322,7 +277,7 @@ def at_least_one_schema_is_allowed(database: Database) -> bool: con = QuerySelectField( _("Database"), - query_factory=excel_allowed_dbs, + query_factory=UploadToDatabaseForm.file_allowed_dbs, get_pk=lambda a: a.id, get_label=lambda a: a.database_name, ) @@ -419,56 +374,7 @@ def at_least_one_schema_is_allowed(database: Database) -> bool: ) -class ColumnarToDatabaseForm(DynamicForm): - # pylint: disable=E0211 - def columnar_allowed_dbs() -> List[Database]: # type: ignore - # TODO: change allow_csv_upload to allow_file_upload - columnar_enabled_dbs = ( - db.session.query(Database).filter_by(allow_csv_upload=True).all() - ) - return [ - columnar_enabled_db - for columnar_enabled_db in columnar_enabled_dbs - if ColumnarToDatabaseForm.at_least_one_schema_is_allowed( - columnar_enabled_db - ) - ] - - @staticmethod - def at_least_one_schema_is_allowed(database: Database) -> bool: - """ - If the user has access to the database or all datasource - 1. if schemas_allowed_for_csv_upload is empty - a) if database does not support schema - user is able to upload columnar without specifying schema name - b) if database supports schema - user is able to upload columnar to any schema - 2. if schemas_allowed_for_csv_upload is not empty - a) if database does not support schema - This situation is impossible and upload will fail - b) if database supports schema - user is able to upload to schema in schemas_allowed_for_csv_upload - elif the user does not access to the database or all datasource - 1. if schemas_allowed_for_csv_upload is empty - a) if database does not support schema - user is unable to upload columnar - b) if database supports schema - user is unable to upload columnar - 2. if schemas_allowed_for_csv_upload is not empty - a) if database does not support schema - This situation is impossible and user is unable to upload columnar - b) if database supports schema - user is able to upload to schema in schemas_allowed_for_csv_upload - """ - if security_manager.can_access_database(database): - return True - schemas = database.get_schema_access_for_csv_upload() - if schemas and security_manager.schemas_accessible_by_user( - database, schemas, False - ): - return True - return False - +class ColumnarToDatabaseForm(UploadToDatabaseForm): name = StringField( _("Table Name"), description=_("Name of table to be created from columnar data."), @@ -499,7 +405,7 @@ def at_least_one_schema_is_allowed(database: Database) -> bool: con = QuerySelectField( _("Database"), - query_factory=columnar_allowed_dbs, + query_factory=UploadToDatabaseForm.file_allowed_dbs, get_pk=lambda a: a.id, get_label=lambda a: a.database_name, ) diff --git a/superset/views/database/mixins.py b/superset/views/database/mixins.py index 2c1fb26df692f..5382181d2a3ff 100644 --- a/superset/views/database/mixins.py +++ b/superset/views/database/mixins.py @@ -48,7 +48,7 @@ class DatabaseMixin: "allow_run_async", "allow_dml", "modified", - "allow_csv_upload", + "allow_file_upload", "expose_in_sqllab", ] add_columns = [ @@ -57,7 +57,7 @@ class DatabaseMixin: "cache_timeout", "expose_in_sqllab", "allow_run_async", - "allow_csv_upload", + "allow_file_upload", "allow_ctas", "allow_cvas", "allow_dml", @@ -136,9 +136,9 @@ class DatabaseMixin: '"table_cache_timeout": 600}**. ' "If unset, cache will not be enabled for the functionality. " "A timeout of 0 indicates that the cache never expires.
" - "3. The ``schemas_allowed_for_csv_upload`` is a comma separated list " + "3. The ``schemas_allowed_for_file_upload`` is a comma separated list " "of schemas that CSVs are allowed to upload to. " - 'Specify it as **"schemas_allowed_for_csv_upload": ' + 'Specify it as **"schemas_allowed_for_file_upload": ' '["public", "csv_upload"]**. ' "If database flavor does not support schema or any schema is allowed " "to be accessed, just leave the list empty
" @@ -177,7 +177,7 @@ class DatabaseMixin: "A timeout of 0 indicates that the cache never expires. " "Note this defaults to the global timeout if undefined." ), - "allow_csv_upload": _( + "allow_file_upload": _( "If selected, please set the schemas allowed for csv upload in Extra." ), } @@ -198,7 +198,7 @@ class DatabaseMixin: "server_cert": _("Root certificate"), "allow_run_async": _("Async Execution"), "impersonate_user": _("Impersonate the logged on user"), - "allow_csv_upload": _("Allow Csv Upload"), + "allow_file_upload": _("Allow Csv Upload"), "modified": _("Modified"), "allow_multi_schema_metadata_fetch": _("Allow Multi Schema Metadata Fetch"), "backend": _("Backend"), diff --git a/superset/views/database/validators.py b/superset/views/database/validators.py index bd3b3335c582b..2b2aa264407ef 100644 --- a/superset/views/database/validators.py +++ b/superset/views/database/validators.py @@ -48,10 +48,10 @@ def sqlalchemy_uri_validator( ) from ex -def schema_allows_csv_upload(database: Database, schema: Optional[str]) -> bool: - if not database.allow_csv_upload: +def schema_allows_file_upload(database: Database, schema: Optional[str]) -> bool: + if not database.allow_file_upload: return False - schemas = database.get_schema_access_for_csv_upload() + schemas = database.get_schema_access_for_file_upload() if schemas: return schema in schemas return security_manager.can_access_database(database) diff --git a/superset/views/database/views.py b/superset/views/database/views.py index 71f6f38954abe..0f2d0f6c2d762 100644 --- a/superset/views/database/views.py +++ b/superset/views/database/views.py @@ -43,7 +43,7 @@ from .forms import ColumnarToDatabaseForm, CsvToDatabaseForm, ExcelToDatabaseForm from .mixins import DatabaseMixin -from .validators import schema_allows_csv_upload, sqlalchemy_uri_validator +from .validators import schema_allows_file_upload, sqlalchemy_uri_validator if TYPE_CHECKING: from werkzeug.datastructures import FileStorage @@ -132,7 +132,7 @@ def form_post(self, form: CsvToDatabaseForm) -> Response: database = form.con.data csv_table = Table(table=form.name.data, schema=form.schema.data) - if not schema_allows_csv_upload(database, csv_table.schema): + if not schema_allows_file_upload(database, csv_table.schema): message = _( 'Database "%(database_name)s" schema "%(schema_name)s" ' "is not allowed for csv uploads. Please contact your Superset Admin.", @@ -279,7 +279,7 @@ def form_post(self, form: ExcelToDatabaseForm) -> Response: database = form.con.data excel_table = Table(table=form.name.data, schema=form.schema.data) - if not schema_allows_csv_upload(database, excel_table.schema): + if not schema_allows_file_upload(database, excel_table.schema): message = _( 'Database "%(database_name)s" schema "%(schema_name)s" ' "is not allowed for excel uploads. Please contact your Superset Admin.", @@ -448,7 +448,7 @@ def form_post( # pylint: disable=too-many-locals "columns": form.usecols.data if form.usecols.data else None, } - if not schema_allows_csv_upload(database, columnar_table.schema): + if not schema_allows_file_upload(database, columnar_table.schema): message = _( 'Database "%(database_name)s" schema "%(schema_name)s" ' "is not allowed for columnar uploads. " diff --git a/tests/integration_tests/base_tests.py b/tests/integration_tests/base_tests.py index e808badf1fe1a..003de23e87b47 100644 --- a/tests/integration_tests/base_tests.py +++ b/tests/integration_tests/base_tests.py @@ -398,7 +398,7 @@ def create_fake_db(self): database_name = FAKE_DB_NAME db_id = 100 extra = """{ - "schemas_allowed_for_csv_upload": + "schemas_allowed_for_file_upload": ["this_schema_is_allowed", "this_schema_is_allowed_too"] }""" diff --git a/tests/integration_tests/core_tests.py b/tests/integration_tests/core_tests.py index c35eb1bc0c2d9..e0614f2ddd5ef 100644 --- a/tests/integration_tests/core_tests.py +++ b/tests/integration_tests/core_tests.py @@ -843,7 +843,7 @@ def create_sample_excelfile(self, filename: str, content: Dict[str, str]) -> Non def enable_csv_upload(self, database: models.Database) -> None: """Enables csv upload in the given database.""" - database.allow_csv_upload = True + database.allow_file_upload = True db.session.commit() add_datasource_page = self.get_resp("/databaseview/list/") self.assertIn("Upload a CSV", add_datasource_page) diff --git a/tests/integration_tests/csv_upload_tests.py b/tests/integration_tests/csv_upload_tests.py index 2e6f3c5f0498d..116c4b0fac9f6 100644 --- a/tests/integration_tests/csv_upload_tests.py +++ b/tests/integration_tests/csv_upload_tests.py @@ -67,7 +67,7 @@ def setup_csv_upload(): extra = upload_db.get_extra() extra["explore_database_id"] = utils.get_example_database().id upload_db.extra = json.dumps(extra) - upload_db.allow_csv_upload = True + upload_db.allow_file_upload = True db.session.commit() yield diff --git a/tests/integration_tests/databases/api_tests.py b/tests/integration_tests/databases/api_tests.py index d3e801e84b742..86b2ad1366051 100644 --- a/tests/integration_tests/databases/api_tests.py +++ b/tests/integration_tests/databases/api_tests.py @@ -161,10 +161,10 @@ def test_get_items(self): self.assertEqual(rv.status_code, 200) response = json.loads(rv.data.decode("utf-8")) expected_columns = [ - "allow_csv_upload", "allow_ctas", "allow_cvas", "allow_dml", + "allow_file_upload", "allow_multi_schema_metadata_fetch", "allow_run_async", "allows_cost_estimate", @@ -232,7 +232,7 @@ def test_create_database(self): "metadata_params": {}, "engine_params": {}, "metadata_cache_timeout": {}, - "schemas_allowed_for_csv_upload": [], + "schemas_allowed_for_file_upload": [], } self.login(username="admin") @@ -265,7 +265,7 @@ def test_create_database_invalid_configuration_method(self): "metadata_params": {}, "engine_params": {}, "metadata_cache_timeout": {}, - "schemas_allowed_for_csv_upload": [], + "schemas_allowed_for_file_upload": [], } self.login(username="admin") @@ -296,7 +296,7 @@ def test_create_database_no_configuration_method(self): "metadata_params": {}, "engine_params": {}, "metadata_cache_timeout": {}, - "schemas_allowed_for_csv_upload": [], + "schemas_allowed_for_file_upload": [], } self.login(username="admin") @@ -386,7 +386,7 @@ def test_create_database_extra_metadata_validate(self): "metadata_params": {"wrong_param": "some_value"}, "engine_params": {}, "metadata_cache_timeout": {}, - "schemas_allowed_for_csv_upload": [], + "schemas_allowed_for_file_upload": [], } self.login(username="admin") database_data = { @@ -906,7 +906,7 @@ def test_test_connection(self): "metadata_params": {}, "engine_params": {}, "metadata_cache_timeout": {}, - "schemas_allowed_for_csv_upload": [], + "schemas_allowed_for_file_upload": [], } # need to temporarily allow sqlite dbs, teardown will undo this app.config["PREVENT_UNSAFE_DB_CONNECTIONS"] = False diff --git a/tests/integration_tests/databases/commands_tests.py b/tests/integration_tests/databases/commands_tests.py index 449dd4c59fafb..c20d6bbeecac9 100644 --- a/tests/integration_tests/databases/commands_tests.py +++ b/tests/integration_tests/databases/commands_tests.py @@ -83,7 +83,7 @@ def test_export_database_command(self, mock_g): "engine_params": {}, "metadata_cache_timeout": {}, "metadata_params": {}, - "schemas_allowed_for_csv_upload": [], + "schemas_allowed_for_file_upload": [], } if backend() == "presto": expected_extra = { @@ -107,7 +107,7 @@ def test_export_database_command(self, mock_g): metadata = yaml.safe_load(contents["databases/examples.yaml"]) assert metadata == ( { - "allow_csv_upload": True, + "allow_file_upload": True, "allow_ctas": True, "allow_cvas": True, "allow_run_async": False, @@ -305,7 +305,7 @@ def test_export_database_command_key_order(self, mock_g): "allow_run_async", "allow_ctas", "allow_cvas", - "allow_csv_upload", + "allow_file_upload", "extra", "uuid", "version", @@ -325,7 +325,7 @@ def test_import_v1_database(self): database = ( db.session.query(Database).filter_by(uuid=database_config["uuid"]).one() ) - assert database.allow_csv_upload + assert database.allow_file_upload assert database.allow_ctas assert database.allow_cvas assert not database.allow_run_async @@ -355,11 +355,11 @@ def test_import_v1_database_multiple(self): database = ( db.session.query(Database).filter_by(uuid=database_config["uuid"]).one() ) - assert database.allow_csv_upload + assert database.allow_file_upload - # update allow_csv_upload to False + # update allow_file_upload to False new_config = database_config.copy() - new_config["allow_csv_upload"] = False + new_config["allow_file_upload"] = False contents = { "databases/imported_database.yaml": yaml.safe_dump(new_config), "metadata.yaml": yaml.safe_dump(database_metadata_config), @@ -370,7 +370,7 @@ def test_import_v1_database_multiple(self): database = ( db.session.query(Database).filter_by(uuid=database_config["uuid"]).one() ) - assert not database.allow_csv_upload + assert not database.allow_file_upload # test that only one database was created new_num_databases = db.session.query(Database).count() diff --git a/tests/integration_tests/fixtures/database.py b/tests/integration_tests/fixtures/database.py index dcb423e5465e0..a2ba522126677 100644 --- a/tests/integration_tests/fixtures/database.py +++ b/tests/integration_tests/fixtures/database.py @@ -18,5 +18,5 @@ "metadata_params": {}, "engine_params": {}, "metadata_cache_timeout": {}, - "schemas_allowed_for_csv_upload": [] + "schemas_allowed_for_file_upload": [] }""" diff --git a/tests/integration_tests/fixtures/importexport.py b/tests/integration_tests/fixtures/importexport.py index e4a2ec29d8611..098e28d4024db 100644 --- a/tests/integration_tests/fixtures/importexport.py +++ b/tests/integration_tests/fixtures/importexport.py @@ -347,7 +347,7 @@ "timestamp": "2021-03-30T20:37:54.791187+00:00", } database_config: Dict[str, Any] = { - "allow_csv_upload": True, + "allow_file_upload": True, "allow_ctas": True, "allow_cvas": True, "allow_run_async": False, diff --git a/tests/integration_tests/model_tests.py b/tests/integration_tests/model_tests.py index e314a1371b418..56956c31abd01 100644 --- a/tests/integration_tests/model_tests.py +++ b/tests/integration_tests/model_tests.py @@ -133,7 +133,7 @@ def test_impersonate_user_presto(self, mocked_create_engine): } }, "metadata_cache_timeout": {}, - "schemas_allowed_for_csv_upload": [] + "schemas_allowed_for_file_upload": [] } """ @@ -206,7 +206,7 @@ def test_impersonate_user_hive(self, mocked_create_engine): } }, "metadata_cache_timeout": {}, - "schemas_allowed_for_csv_upload": [] + "schemas_allowed_for_file_upload": [] } """