mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
chore: remove RemovedInMarshmallow4 warnings (#23704)
This commit is contained in:
committed by
GitHub
parent
295975d16b
commit
b31efbae7c
@@ -243,18 +243,22 @@ class DatabaseParametersSchemaMixin: # pylint: disable=too-few-public-methods
|
||||
When using this mixin make sure that `sqlalchemy_uri` is not required.
|
||||
"""
|
||||
|
||||
engine = fields.String(allow_none=True, description="SQLAlchemy engine to use")
|
||||
driver = fields.String(allow_none=True, description="SQLAlchemy driver to use")
|
||||
engine = fields.String(
|
||||
allow_none=True, metadata={"description": "SQLAlchemy engine to use"}
|
||||
)
|
||||
driver = fields.String(
|
||||
allow_none=True, metadata={"description": "SQLAlchemy driver to use"}
|
||||
)
|
||||
parameters = fields.Dict(
|
||||
keys=fields.String(),
|
||||
values=fields.Raw(),
|
||||
description="DB-specific parameters for configuration",
|
||||
metadata={"description": "DB-specific parameters for configuration"},
|
||||
)
|
||||
configuration_method = EnumField(
|
||||
ConfigurationMethod,
|
||||
by_value=True,
|
||||
description=configuration_method_description,
|
||||
missing=ConfigurationMethod.SQLALCHEMY_FORM,
|
||||
metadata={"description": configuration_method_description},
|
||||
load_default=ConfigurationMethod.SQLALCHEMY_FORM,
|
||||
)
|
||||
|
||||
@pre_load
|
||||
@@ -341,33 +345,45 @@ class DatabaseValidateParametersSchema(Schema):
|
||||
|
||||
rename_encrypted_extra = pre_load(rename_encrypted_extra)
|
||||
|
||||
id = fields.Integer(allow_none=True, description="Database ID (for updates)")
|
||||
engine = fields.String(required=True, description="SQLAlchemy engine to use")
|
||||
driver = fields.String(allow_none=True, description="SQLAlchemy driver to use")
|
||||
id = fields.Integer(
|
||||
allow_none=True, metadata={"description": "Database ID (for updates)"}
|
||||
)
|
||||
engine = fields.String(
|
||||
required=True, metadata={"description": "SQLAlchemy engine to use"}
|
||||
)
|
||||
driver = fields.String(
|
||||
allow_none=True, metadata={"description": "SQLAlchemy driver to use"}
|
||||
)
|
||||
parameters = fields.Dict(
|
||||
keys=fields.String(),
|
||||
values=fields.Raw(allow_none=True),
|
||||
description="DB-specific parameters for configuration",
|
||||
metadata={"description": "DB-specific parameters for configuration"},
|
||||
)
|
||||
catalog = fields.Dict(
|
||||
keys=fields.String(),
|
||||
values=fields.Raw(allow_none=True),
|
||||
description="Gsheets specific column for managing label to sheet urls",
|
||||
metadata={
|
||||
"description": "Gsheets specific column for managing label to sheet urls"
|
||||
},
|
||||
)
|
||||
database_name = fields.String(
|
||||
description=database_name_description,
|
||||
metadata={"description": database_name_description},
|
||||
allow_none=True,
|
||||
validate=Length(1, 250),
|
||||
)
|
||||
impersonate_user = fields.Boolean(description=impersonate_user_description)
|
||||
extra = fields.String(description=extra_description, validate=extra_validator)
|
||||
impersonate_user = fields.Boolean(
|
||||
metadata={"description": impersonate_user_description}
|
||||
)
|
||||
extra = fields.String(
|
||||
metadata={"description": extra_description}, validate=extra_validator
|
||||
)
|
||||
masked_encrypted_extra = fields.String(
|
||||
description=encrypted_extra_description,
|
||||
metadata={"description": encrypted_extra_description},
|
||||
validate=encrypted_extra_validator,
|
||||
allow_none=True,
|
||||
)
|
||||
server_cert = fields.String(
|
||||
description=server_cert_description,
|
||||
metadata={"description": server_cert_description},
|
||||
allow_none=True,
|
||||
validate=server_cert_validator,
|
||||
)
|
||||
@@ -375,12 +391,14 @@ class DatabaseValidateParametersSchema(Schema):
|
||||
ConfigurationMethod,
|
||||
by_value=True,
|
||||
required=True,
|
||||
description=configuration_method_description,
|
||||
metadata={"description": configuration_method_description},
|
||||
)
|
||||
|
||||
|
||||
class DatabaseSSHTunnel(Schema):
|
||||
id = fields.Integer(allow_none=True, description="SSH Tunnel ID (for updates)")
|
||||
id = fields.Integer(
|
||||
allow_none=True, metadata={"description": "SSH Tunnel ID (for updates)"}
|
||||
)
|
||||
server_address = fields.String()
|
||||
server_port = fields.Integer()
|
||||
username = fields.String()
|
||||
@@ -400,41 +418,51 @@ class DatabasePostSchema(Schema, DatabaseParametersSchemaMixin):
|
||||
rename_encrypted_extra = pre_load(rename_encrypted_extra)
|
||||
|
||||
database_name = fields.String(
|
||||
description=database_name_description,
|
||||
metadata={"description": database_name_description},
|
||||
required=True,
|
||||
validate=Length(1, 250),
|
||||
)
|
||||
cache_timeout = fields.Integer(
|
||||
description=cache_timeout_description, allow_none=True
|
||||
metadata={"description": cache_timeout_description}, allow_none=True
|
||||
)
|
||||
expose_in_sqllab = fields.Boolean(description=expose_in_sqllab_description)
|
||||
allow_run_async = fields.Boolean(description=allow_run_async_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)
|
||||
expose_in_sqllab = fields.Boolean(
|
||||
metadata={"description": expose_in_sqllab_description}
|
||||
)
|
||||
allow_run_async = fields.Boolean(
|
||||
metadata={"description": allow_run_async_description}
|
||||
)
|
||||
allow_file_upload = fields.Boolean(
|
||||
metadata={"description": allow_file_upload_description}
|
||||
)
|
||||
allow_ctas = fields.Boolean(metadata={"description": allow_ctas_description})
|
||||
allow_cvas = fields.Boolean(metadata={"description": allow_cvas_description})
|
||||
allow_dml = fields.Boolean(metadata={"description": allow_dml_description})
|
||||
force_ctas_schema = fields.String(
|
||||
description=force_ctas_schema_description,
|
||||
metadata={"description": force_ctas_schema_description},
|
||||
allow_none=True,
|
||||
validate=Length(0, 250),
|
||||
)
|
||||
impersonate_user = fields.Boolean(description=impersonate_user_description)
|
||||
impersonate_user = fields.Boolean(
|
||||
metadata={"description": impersonate_user_description}
|
||||
)
|
||||
masked_encrypted_extra = fields.String(
|
||||
description=encrypted_extra_description,
|
||||
metadata={"description": encrypted_extra_description},
|
||||
validate=encrypted_extra_validator,
|
||||
allow_none=True,
|
||||
)
|
||||
extra = fields.String(description=extra_description, validate=extra_validator)
|
||||
extra = fields.String(
|
||||
metadata={"description": extra_description}, validate=extra_validator
|
||||
)
|
||||
server_cert = fields.String(
|
||||
description=server_cert_description,
|
||||
metadata={"description": server_cert_description},
|
||||
allow_none=True,
|
||||
validate=server_cert_validator,
|
||||
)
|
||||
sqlalchemy_uri = fields.String(
|
||||
description=sqlalchemy_uri_description,
|
||||
metadata={"description": sqlalchemy_uri_description},
|
||||
validate=[Length(1, 1024), sqlalchemy_uri_validator],
|
||||
)
|
||||
is_managed_externally = fields.Boolean(allow_none=True, default=False)
|
||||
is_managed_externally = fields.Boolean(allow_none=True, dump_default=False)
|
||||
external_url = fields.String(allow_none=True)
|
||||
uuid = fields.String(required=False)
|
||||
ssh_tunnel = fields.Nested(DatabaseSSHTunnel, allow_none=True)
|
||||
@@ -447,41 +475,51 @@ class DatabasePutSchema(Schema, DatabaseParametersSchemaMixin):
|
||||
rename_encrypted_extra = pre_load(rename_encrypted_extra)
|
||||
|
||||
database_name = fields.String(
|
||||
description=database_name_description,
|
||||
metadata={"description": database_name_description},
|
||||
allow_none=True,
|
||||
validate=Length(1, 250),
|
||||
)
|
||||
cache_timeout = fields.Integer(
|
||||
description=cache_timeout_description, allow_none=True
|
||||
metadata={"description": cache_timeout_description}, allow_none=True
|
||||
)
|
||||
expose_in_sqllab = fields.Boolean(description=expose_in_sqllab_description)
|
||||
allow_run_async = fields.Boolean(description=allow_run_async_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)
|
||||
expose_in_sqllab = fields.Boolean(
|
||||
metadata={"description": expose_in_sqllab_description}
|
||||
)
|
||||
allow_run_async = fields.Boolean(
|
||||
metadata={"description": allow_run_async_description}
|
||||
)
|
||||
allow_file_upload = fields.Boolean(
|
||||
metadata={"description": allow_file_upload_description}
|
||||
)
|
||||
allow_ctas = fields.Boolean(metadata={"description": allow_ctas_description})
|
||||
allow_cvas = fields.Boolean(metadata={"description": allow_cvas_description})
|
||||
allow_dml = fields.Boolean(metadata={"description": allow_dml_description})
|
||||
force_ctas_schema = fields.String(
|
||||
description=force_ctas_schema_description,
|
||||
metadata={"description": force_ctas_schema_description},
|
||||
allow_none=True,
|
||||
validate=Length(0, 250),
|
||||
)
|
||||
impersonate_user = fields.Boolean(description=impersonate_user_description)
|
||||
impersonate_user = fields.Boolean(
|
||||
metadata={"description": impersonate_user_description}
|
||||
)
|
||||
masked_encrypted_extra = fields.String(
|
||||
description=encrypted_extra_description,
|
||||
metadata={"description": encrypted_extra_description},
|
||||
allow_none=True,
|
||||
validate=encrypted_extra_validator,
|
||||
)
|
||||
extra = fields.String(description=extra_description, validate=extra_validator)
|
||||
extra = fields.String(
|
||||
metadata={"description": extra_description}, validate=extra_validator
|
||||
)
|
||||
server_cert = fields.String(
|
||||
description=server_cert_description,
|
||||
metadata={"description": server_cert_description},
|
||||
allow_none=True,
|
||||
validate=server_cert_validator,
|
||||
)
|
||||
sqlalchemy_uri = fields.String(
|
||||
description=sqlalchemy_uri_description,
|
||||
metadata={"description": sqlalchemy_uri_description},
|
||||
validate=[Length(0, 1024), sqlalchemy_uri_validator],
|
||||
)
|
||||
is_managed_externally = fields.Boolean(allow_none=True, default=False)
|
||||
is_managed_externally = fields.Boolean(allow_none=True, dump_default=False)
|
||||
external_url = fields.String(allow_none=True)
|
||||
ssh_tunnel = fields.Nested(DatabaseSSHTunnel, allow_none=True)
|
||||
uuid = fields.String(required=False)
|
||||
@@ -491,24 +529,28 @@ class DatabaseTestConnectionSchema(Schema, DatabaseParametersSchemaMixin):
|
||||
rename_encrypted_extra = pre_load(rename_encrypted_extra)
|
||||
|
||||
database_name = fields.String(
|
||||
description=database_name_description,
|
||||
metadata={"description": database_name_description},
|
||||
allow_none=True,
|
||||
validate=Length(1, 250),
|
||||
)
|
||||
impersonate_user = fields.Boolean(description=impersonate_user_description)
|
||||
extra = fields.String(description=extra_description, validate=extra_validator)
|
||||
impersonate_user = fields.Boolean(
|
||||
metadata={"description": impersonate_user_description}
|
||||
)
|
||||
extra = fields.String(
|
||||
metadata={"description": extra_description}, validate=extra_validator
|
||||
)
|
||||
masked_encrypted_extra = fields.String(
|
||||
description=encrypted_extra_description,
|
||||
metadata={"description": encrypted_extra_description},
|
||||
validate=encrypted_extra_validator,
|
||||
allow_none=True,
|
||||
)
|
||||
server_cert = fields.String(
|
||||
description=server_cert_description,
|
||||
metadata={"description": server_cert_description},
|
||||
allow_none=True,
|
||||
validate=server_cert_validator,
|
||||
)
|
||||
sqlalchemy_uri = fields.String(
|
||||
description=sqlalchemy_uri_description,
|
||||
metadata={"description": sqlalchemy_uri_description},
|
||||
validate=[Length(1, 1024), sqlalchemy_uri_validator],
|
||||
)
|
||||
|
||||
@@ -524,20 +566,27 @@ class TableMetadataOptionsResponseSchema(Schema):
|
||||
|
||||
|
||||
class TableMetadataColumnsResponseSchema(Schema):
|
||||
keys = fields.List(fields.String(), description="")
|
||||
longType = fields.String(description="The actual backend long type for the column")
|
||||
name = fields.String(description="The column name")
|
||||
type = fields.String(description="The column type")
|
||||
keys = fields.List(fields.String(), metadata={"description": ""})
|
||||
longType = fields.String(
|
||||
metadata={"description": "The actual backend long type for the column"}
|
||||
)
|
||||
name = fields.String(metadata={"description": "The column name"})
|
||||
type = fields.String(metadata={"description": "The column type"})
|
||||
duplicates_constraint = fields.String(required=False)
|
||||
|
||||
|
||||
class TableMetadataForeignKeysIndexesResponseSchema(Schema):
|
||||
column_names = fields.List(
|
||||
fields.String(
|
||||
description="A list of column names that compose the foreign key or index"
|
||||
metadata={
|
||||
"description": "A list of column names that compose the foreign key or "
|
||||
" index"
|
||||
}
|
||||
)
|
||||
)
|
||||
name = fields.String(description="The name of the foreign key or index")
|
||||
name = fields.String(
|
||||
metadata={"description": "The name of the foreign key or index"}
|
||||
)
|
||||
options = fields.Nested(TableMetadataOptionsResponseSchema)
|
||||
referred_columns = fields.List(fields.String())
|
||||
referred_schema = fields.String()
|
||||
@@ -547,30 +596,35 @@ class TableMetadataForeignKeysIndexesResponseSchema(Schema):
|
||||
|
||||
class TableMetadataPrimaryKeyResponseSchema(Schema):
|
||||
column_names = fields.List(
|
||||
fields.String(description="A list of column names that compose the primary key")
|
||||
fields.String(
|
||||
metadata={
|
||||
"description": "A list of column names that compose the primary key"
|
||||
}
|
||||
)
|
||||
)
|
||||
name = fields.String(description="The primary key index name")
|
||||
name = fields.String(metadata={"description": "The primary key index name"})
|
||||
type = fields.String()
|
||||
|
||||
|
||||
class TableMetadataResponseSchema(Schema):
|
||||
name = fields.String(description="The name of the table")
|
||||
name = fields.String(metadata={"description": "The name of the table"})
|
||||
columns = fields.List(
|
||||
fields.Nested(TableMetadataColumnsResponseSchema),
|
||||
description="A list of columns and their metadata",
|
||||
metadata={"description": "A list of columns and their metadata"},
|
||||
)
|
||||
foreignKeys = fields.List(
|
||||
fields.Nested(TableMetadataForeignKeysIndexesResponseSchema),
|
||||
description="A list of foreign keys and their metadata",
|
||||
metadata={"description": "A list of foreign keys and their metadata"},
|
||||
)
|
||||
indexes = fields.List(
|
||||
fields.Nested(TableMetadataForeignKeysIndexesResponseSchema),
|
||||
description="A list of indexes and their metadata",
|
||||
metadata={"description": "A list of indexes and their metadata"},
|
||||
)
|
||||
primaryKey = fields.Nested(
|
||||
TableMetadataPrimaryKeyResponseSchema, description="Primary keys metadata"
|
||||
TableMetadataPrimaryKeyResponseSchema,
|
||||
metadata={"description": "Primary keys metadata"},
|
||||
)
|
||||
selectStar = fields.String(description="SQL select star")
|
||||
selectStar = fields.String(metadata={"description": "SQL select star"})
|
||||
|
||||
|
||||
class TableExtraMetadataResponseSchema(Schema):
|
||||
@@ -580,21 +634,27 @@ class TableExtraMetadataResponseSchema(Schema):
|
||||
|
||||
|
||||
class SelectStarResponseSchema(Schema):
|
||||
result = fields.String(description="SQL select star")
|
||||
result = fields.String(metadata={"description": "SQL select star"})
|
||||
|
||||
|
||||
class SchemasResponseSchema(Schema):
|
||||
result = fields.List(fields.String(description="A database schema name"))
|
||||
result = fields.List(
|
||||
fields.String(metadata={"description": "A database schema name"})
|
||||
)
|
||||
|
||||
|
||||
class DatabaseTablesResponse(Schema):
|
||||
extra = fields.Dict(description="Extra data used to specify column metadata")
|
||||
type = fields.String(description="table or view")
|
||||
value = fields.String(description="The table or view name")
|
||||
extra = fields.Dict(
|
||||
metadata={"description": "Extra data used to specify column metadata"}
|
||||
)
|
||||
type = fields.String(metadata={"description": "table or view"})
|
||||
value = fields.String(metadata={"description": "The table or view name"})
|
||||
|
||||
|
||||
class ValidateSQLRequest(Schema):
|
||||
sql = fields.String(required=True, description="SQL statement to validate")
|
||||
sql = fields.String(
|
||||
required=True, metadata={"description": "SQL statement to validate"}
|
||||
)
|
||||
schema = fields.String(required=False, allow_none=True)
|
||||
template_params = fields.Dict(required=False, allow_none=True)
|
||||
|
||||
@@ -620,16 +680,18 @@ class DatabaseRelatedDashboard(Schema):
|
||||
|
||||
|
||||
class DatabaseRelatedCharts(Schema):
|
||||
count = fields.Integer(description="Chart count")
|
||||
count = fields.Integer(metadata={"description": "Chart count"})
|
||||
result = fields.List(
|
||||
fields.Nested(DatabaseRelatedChart), description="A list of dashboards"
|
||||
fields.Nested(DatabaseRelatedChart),
|
||||
metadata={"description": "A list of dashboards"},
|
||||
)
|
||||
|
||||
|
||||
class DatabaseRelatedDashboards(Schema):
|
||||
count = fields.Integer(description="Dashboard count")
|
||||
count = fields.Integer(metadata={"description": "Dashboard count"})
|
||||
result = fields.List(
|
||||
fields.Nested(DatabaseRelatedDashboard), description="A list of dashboards"
|
||||
fields.Nested(DatabaseRelatedDashboard),
|
||||
metadata={"description": "A list of dashboards"},
|
||||
)
|
||||
|
||||
|
||||
@@ -708,7 +770,7 @@ class ImportV1DatabaseSchema(Schema):
|
||||
extra = fields.Nested(ImportV1DatabaseExtraSchema)
|
||||
uuid = fields.UUID(required=True)
|
||||
version = fields.String(required=True)
|
||||
is_managed_externally = fields.Boolean(allow_none=True, default=False)
|
||||
is_managed_externally = fields.Boolean(allow_none=True, dump_default=False)
|
||||
external_url = fields.String(allow_none=True)
|
||||
ssh_tunnel = fields.Nested(DatabaseSSHTunnel, allow_none=True)
|
||||
|
||||
@@ -813,5 +875,8 @@ def encrypted_field_properties(self, field: Any, **_) -> Dict[str, Any]: # type
|
||||
class DatabaseSchemaAccessForFileUploadResponse(Schema):
|
||||
schemas = fields.List(
|
||||
fields.String(),
|
||||
description="The list of schemas allowed for the database to upload information",
|
||||
metadata={
|
||||
"description": "The list of schemas allowed for the database to upload "
|
||||
"information"
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user