home / docs / sections

sections

13 rows where breadcrumbs contains "Configuration", page = "configuration" and references = "[]"

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: breadcrumbs

id ▼ page ref title content breadcrumbs references
configuration:configuration-reference configuration configuration-reference   The following example shows some of the valid configuration options that can exist inside datasette.yaml . [[[cog from metadata_doc import config_example import textwrap config_example(cog, textwrap.dedent( """ # Datasette settings block settings: default_page_size: 50 sql_time_limit_ms: 3500 max_returned_rows: 2000 # top-level plugin configuration plugins: datasette-my-plugin: key: valueA # Database and table-level configuration databases: your_db_name: # plugin configuration for the your_db_name database plugins: datasette-my-plugin: key: valueA tables: your_table_name: allow: # Only the root user can access this table id: root # plugin configuration for the your_table_name table # inside your_db_name database plugins: datasette-my-plugin: key: valueB """) ) ]]] [[[end]]] ["Configuration"] []
configuration:configuration-reference-canned-queries configuration configuration-reference-canned-queries Canned queries configuration Canned queries are named SQL queries that appear in the Datasette interface. They can be configured in datasette.yaml using the queries key at the database level: [[[cog from metadata_doc import config_example, config_example config_example(cog, { "databases": { "sf-trees": { "queries": { "just_species": { "sql": "select qSpecies from Street_Tree_List" } } } } }) ]]] [[[end]]] See the canned queries documentation for more, including how to configure writable canned queries . ["Configuration", null] []
configuration:configuration-reference-permissions configuration configuration-reference-permissions Permissions configuration Datasette's authentication and permissions system can also be configured using datasette.yaml . Here is a simple example: [[[cog from metadata_doc import config_example import textwrap config_example(cog, textwrap.dedent( """ # Instance is only available to users 'sharon' and 'percy': allow: id: - sharon - percy # Only 'percy' is allowed access to the accounting database: databases: accounting: allow: id: percy """).strip() ) ]]] [[[end]]] Access permissions in datasette.yaml has the full details. ["Configuration", null] []
configuration:configuration-reference-plugins configuration configuration-reference-plugins Plugin configuration Datasette plugins often require configuration. This plugin configuration should be placed in plugins keys inside datasette.yaml . Most plugins are configured at the top-level of the file, using the plugins key: [[[cog from metadata_doc import config_example import textwrap config_example(cog, textwrap.dedent( """ # inside datasette.yaml plugins: datasette-my-plugin: key: my_value """).strip() ) ]]] [[[end]]] Some plugins can be configured at the database or table level. These should use a plugins key nested under the appropriate place within the databases object: [[[cog from metadata_doc import config_example import textwrap config_example(cog, textwrap.dedent( """ # inside datasette.yaml databases: my_database: # plugin configuration for the my_database database plugins: datasette-my-plugin: key: my_value my_other_database: tables: my_table: # plugin configuration for the my_table table inside the my_other_database database plugins: datasette-my-plugin: key: my_value """).strip() ) ]]] [[[end]]] ["Configuration", null] []
configuration:configuration-reference-settings configuration configuration-reference-settings Settings Settings can be configured in datasette.yaml with the settings key: [[[cog from metadata_doc import config_example import textwrap config_example(cog, textwrap.dedent( """ # inside datasette.yaml settings: default_allow_sql: off default_page_size: 50 """).strip() ) ]]] [[[end]]] The full list of settings is available in the settings documentation . Settings can also be passed to Datasette using one or more --setting name value command line options.` ["Configuration", null] []
configuration:configuration-reference-table configuration configuration-reference-table Table configuration Datasette supports a number of table-level configuration options inside datasette.yaml . These are placed under databases.database_name.tables.table_name . ["Configuration", null] []
configuration:table-configuration-column-types configuration table-configuration-column-types   You can assign semantic column types to columns, which affect how values are rendered, validated, and transformed. Built-in column types include url , email , and json . Plugins can register additional column types using the register_column_types plugin hook. Column types can optionally declare which SQLite column types they apply to using sqlite_types . Datasette will reject incompatible assignments. The built-in url , email , and json column types are all restricted to TEXT columns. The simplest form maps column names to type name strings: [[[cog config_example(cog, textwrap.dedent( """ databases: mydatabase: tables: example_table: column_types: website: url contact: email extra_data: json """).strip() ) ]]] [[[end]]] For column types that accept additional configuration, use an object with type and config keys: [[[cog config_example(cog, textwrap.dedent( """ databases: mydatabase: tables: example_table: column_types: website: type: url config: prefix: "https://" """).strip() ) ]]] [[[end]]] ["Configuration", null, "Table configuration"] []
configuration:table-configuration-facets configuration table-configuration-facets   You can turn on facets by default for specific tables. facet_size controls how many unique values are shown for each facet on that table (the default is controlled by the default_facet_size setting). See Facets in configuration for full details. [[[cog config_example(cog, textwrap.dedent( """ databases: sf-trees: tables: Street_Tree_List: facets: - qLegalStatus facet_size: 10 """).strip() ) ]]] [[[end]]] You can also specify array or date facets using JSON objects with a single key of array or date : facets: - array: tags - date: created ["Configuration", null, "Table configuration"] []
configuration:table-configuration-hidden configuration table-configuration-hidden   You can hide tables from the database listing view (in the same way that FTS and SpatiaLite tables are automatically hidden) using "hidden": true : [[[cog config_example(cog, textwrap.dedent( """ databases: mydatabase: tables: example_table: hidden: true """).strip() ) ]]] [[[end]]] ["Configuration", null, "Table configuration"] []
configuration:table-configuration-label-column configuration table-configuration-label-column   Datasette's HTML interface attempts to display foreign key references as labelled hyperlinks. By default, it automatically detects a label column using the following rules (in order): If there is exactly one unique text column, use that. If there is a column called name or title (case-insensitive), use that. If the table has only two columns - a primary key and one other - use the non-primary-key column. You can override this automatic detection by specifying which column should be used for the link label with the label_column property: [[[cog config_example(cog, textwrap.dedent( """ databases: mydatabase: tables: example_table: label_column: title """).strip() ) ]]] [[[end]]] ["Configuration", null, "Table configuration"] []
configuration:table-configuration-size configuration table-configuration-size   Datasette defaults to displaying 100 rows per page, for both tables and views. You can change this on a per-table or per-view basis using the size key: [[[cog config_example(cog, textwrap.dedent( """ databases: mydatabase: tables: example_table: size: 10 """).strip() ) ]]] [[[end]]] This size can still be over-ridden by passing e.g. ?_size=50 in the query string. ["Configuration", null, "Table configuration"] []
configuration:table-configuration-sort configuration table-configuration-sort   By default Datasette tables are sorted by primary key. You can set a default sort order for a specific table using the sort or sort_desc properties: [[[cog from metadata_doc import config_example import textwrap config_example(cog, textwrap.dedent( """ databases: mydatabase: tables: example_table: sort: created """).strip() ) ]]] [[[end]]] Or use sort_desc to sort in descending order: [[[cog config_example(cog, textwrap.dedent( """ databases: mydatabase: tables: example_table: sort_desc: created """).strip() ) ]]] [[[end]]] ["Configuration", null, "Table configuration"] []
configuration:table-configuration-sortable-columns configuration table-configuration-sortable-columns   Datasette allows any column to be used for sorting by default. If you need to control which columns are available for sorting you can do so using sortable_columns : [[[cog config_example(cog, textwrap.dedent( """ databases: mydatabase: tables: example_table: sortable_columns: - height - weight """).strip() ) ]]] [[[end]]] This will restrict sorting of example_table to just the height and weight columns. You can also disable sorting entirely by setting "sortable_columns": [] You can use sortable_columns to enable specific sort orders for a view called name_of_view in the database my_database like so: [[[cog config_example(cog, textwrap.dedent( """ databases: my_database: tables: name_of_view: sortable_columns: - clicks - impressions """).strip() ) ]]] [[[end]]] ["Configuration", null, "Table configuration"] []

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [sections] (
   [id] TEXT PRIMARY KEY,
   [page] TEXT,
   [ref] TEXT,
   [title] TEXT,
   [content] TEXT,
   [breadcrumbs] TEXT,
   [references] TEXT
);
Powered by Datasette · Queries took 1.2ms