Here are all of the available settings with their default values.
Disallowed words in SQL queries to prevent destructive actions.
EXPLORER_SQL_BLACKLIST = (
# DML
'COMMIT',
'DELETE',
'INSERT',
'MERGE',
'REPLACE',
'ROLLBACK',
'SET',
'START',
'UPDATE',
'UPSERT',
# DDL
'ALTER',
'CREATE',
'DROP',
'RENAME',
'TRUNCATE',
# DCL
'GRANT',
'REVOKE',
)
The number of rows to show by default in the preview pane.
EXPLORER_DEFAULT_ROWS = 1000
If not None
, show schema only for tables starting with these prefixes. "Wins" if in conflict with EXCLUDE
EXPLORER_SCHEMA_INCLUDE_TABLE_PREFIXES = None # shows all tables
Don't show schema for tables starting with these prefixes, in the schema helper.
EXPLORER_SCHEMA_EXCLUDE_TABLE_PREFIXES = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin'
)
Include database views
EXPLORER_SCHEMA_INCLUDE_VIEWS = False
Generate DB schema asynchronously. Requires Celery and EXPLORER_TASKS_ENABLED
EXPLORER_ASYNC_SCHEMA = False
The name of the Django database connection to use. Ideally set this to a connection with read only permissions
EXPLORER_DEFAULT_CONNECTION = None # Must be set for the app to work, as this is required
A dictionary of {'Friendly Name': 'django_db_alias'}
.
EXPLORER_CONNECTIONS = {} # At a minimum, should be set to something like { 'Default': 'readonly' } or similar. See connections.py for more documentation.
Callback to check if the user is allowed to view and execute stored queries
EXPLORER_PERMISSION_VIEW = lambda r: r.user.is_staff
Callback to check if the user is allowed to add/change/delete queries
EXPLORER_PERMISSION_CHANGE = lambda r: r.user.is_staff
List of tuples, see :ref:`Template Columns` more info.
EXPLORER_TRANSFORMS = []
The number of recent queries to show at the top of the query listing.
EXPLORER_RECENT_QUERY_COUNT = 10
A dict granting view permissions on specific queries of the form
EXPLORER_GET_USER_QUERY_VIEWS = {userId: [queryId, ], }
Default Value:
EXPLORER_GET_USER_QUERY_VIEWS = {}
Bool indicating whether token-authenticated requests should be enabled. See :ref:`Power Tips`.
EXPLORER_TOKEN_AUTH_ENABLED = False
Access token for query results.
EXPLORER_TOKEN = "CHANGEME"
Turn on if you want to use the snapshot_queries
celery task, or email report functionality in tasks.py
EXPLORER_TASKS_ENABLED = False
S3 Access Key for snapshot upload
EXPLORER_S3_ACCESS_KEY = None
S3 Secret Key for snapshot upload
EXPLORER_S3_SECRET_KEY = None
S3 Bucket for snapshot upload
EXPLORER_S3_BUCKET = None
S3 region. Defaults to us-east-1 if not specified.
EXPLORER_S3_REGION = 'us-east-1'
S3 endpoint url. Normally not necessary to set. Useful to set if you are using a non-AWS S3 service or you are using a private AWS endpoint.
EXPLORER_S3_ENDPOINT_URL = 'https://accesspoint.vpce-abc123-abcdefgh.s3.us-east-1.vpce.amazonaws.com'
S3 destination path. Defaults to empty string.
Useful to set destination folder relative to S3 bucket.
Along with settings EXPLORER_S3_ENDPOINT_URL
and EXPLORER_S3_BUCKET
you can specify full destination path for async query results.
EXPLORER_S3_DESTINATION = 'explorer/query'
# if
EXPLORER_S3_ENDPOINT_URL = 'https://amazonaws.com'
EXPLORER_S3_BUCKET = 'test-bucket'
# then files will be saved to
# https://amazonaws.com/test-bucket/explorer/query/filename1.csv
# where `filename1.csv` is generated filename
S3 link expiration time. Defaults to 3600 seconds (1hr) if not specified. Links are generated as presigned urls for security
EXPLORER_S3_LINK_EXPIRATION = 3600
The signature version when signing requests.
As of boto3
version 1.13.21 the default signature version used for generating presigned urls is still v2
.
To be able to access your s3 objects in all regions through presigned urls, explicitly set this to s3v4
.
EXPLORER_S3_SIGNATURE_VERSION = 's3v4'
The default 'from' address when using async report email functionality
EXPLORER_FROM_EMAIL = "django-sql-explorer@example.com"
The export buttons to use. Default includes Excel, so xlsxwriter from requirements/optional.txt
is needed
EXPLORER_DATA_EXPORTERS = [
('csv', 'explorer.exporters.CSVExporter'),
('excel', 'explorer.exporters.ExcelExporter'),
('json', 'explorer.exporters.JSONExporter')
]
Disable auto escaping for rendering values from the database. Be wary of XSS attacks if querying unknown data.
EXPLORER_UNSAFE_RENDERING = False
Path to a view used when the user does not have permission. By default, a basic login view is provided but a dotted path to a python view can be used
EXPLORER_NO_PERMISSION_VIEW = 'explorer.views.auth.safe_login_view_wrapper'
By default, anonymous usage statistics are collected. To disable this, set the following setting to False. You can see what is being collected in telemetry.py.
EXPLORER_ENABLE_ANONYMOUS_STATS = False
The following three settings control the SQL Assistant. More information is available in :doc:`install` instructions.
EXPLORER_AI_API_KEY = getattr(settings, "EXPLORER_AI_API_KEY", None)
EXPLORER_ASSISTANT_BASE_URL = getattr(settings, "EXPLORER_ASSISTANT_BASE_URL", "https://api.openai.com/v1")
EXPLORER_ASSISTANT_MODEL