class_docstr: Custom filter for the GET list that filters all databases based on allow_file_upload
class_docstr_tok: ["Custom","filter","for","the","GET","list","that","filters","all","databases","based","on","allow_file_upload"]
code: def apply(self, query: Query, value: Any) -> Query:
      filtered_query = query.filter(Database.allow_file_upload)
  
      datasource_access_databases = can_access_databases(
          "datasource_access"
      )
  
      if hasattr(g, "user"):
          allowed_schemas = [
              app.config["ALLOWED_USER_CSV_SCHEMA_FUNC"](db, g.user)
              for db in datasource_access_databases
          ]
  
          if len(allowed_schemas):
              return filtered_query
  
      return filtered_query.filter(
          or_(
              cast(Database.extra, JSON)[
                  "schemas_allowed_for_file_upload"
              ]
              is not None,
              cast(Database.extra, JSON)[
                  "schemas_allowed_for_file_upload"
              ]
              != [],
          )
      )
  
file_path: superset/superset/databases/filters.py
imports: from typing import Any
  from flask import current_app, g
  from flask_babel import lazy_gettext
  from sqlalchemy import or_
  from sqlalchemy.orm import Query
  from sqlalchemy.sql.expression import cast
  from sqlalchemy.sql.sqltypes import JSON
  from superset import app, security_manager
  from superset.models.core import Database
  from superset.views.base import BaseFilter
label_desc: Use image node_id 1 for calling the DatabaseUploadEnabledFilter obj's underlying member method code with example usage: obj.apply(query, value) and returns: filtered_query, filtered_query