home / docs / sections

Menu

sections

8 rows where breadcrumbs contains "Table configuration"

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: references

id ▼ page ref title content breadcrumbs references
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-fts configuration table-configuration-fts   These configure full-text search for a table or view. See Configuring full-text search for a table or view for full details. fts_table specifies which FTS table to use for search. fts_pk sets the primary key column if it is something other than rowid . searchmode can be set to "raw" to enable SQLite advanced search operators . [[[cog config_example(cog, textwrap.dedent( """ databases: russian-ads: tables: display_ads: fts_table: ads_fts fts_pk: id searchmode: raw """).strip() ) ]]] [[[end]]] ["Configuration", null, "Table configuration"] [{"href": "https://www.sqlite.org/fts5.html#full_text_query_syntax", "label": "SQLite advanced search operators"}]
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