Skip to content

Database Source provider

The Database Source feeds data from local or external MySQL Database Tables, supporting Record and Records queries with relations and dynamic filtering and/or ordering.

Settings

Source Instance Common Settings

SettingDescriptionDefault
NameThe name that will identify this source instance.
Default Cache TimeThe default duration in seconds before the cache is renewed, set to 0 to disable caching. This setting can be overriden in each query configuration.3600

Database Source Configuration

SettingDescriptionRequired
DatabaseThe name of the database to which to connect to. Defaults to the site database.
TableThe table from which to create the source.
Primary KeyThe primary key of the selected table, this is specially important when using relations.
Custom ConnectionShould the connection to the database use custom connection instead of the site one.
RelationsThe list of relations and their configuration.

The connection to the database will use the site configuration, but if Custom Connection is enabled the settings inputs will be used instead with support for local as remote servers.

Database Instance Connection

SettingDescriptionRequired
HostThe IP or domain of the database server.
PortThe port which to use to connect to the server.
Username / PasswordThe credentials which to use to connect to the server.

Complex data structures typically involve several tables related between them, if that's the case you can set as many relations as needed of the type:

TypeDescription
One to OneAlso known as BelongsTo, where a single entry relates with another single entry, e.g. Article belongs to an Author.
One to ManyAlso known as HasMany, where a single entry relates with multiple entries, e.g. Article is assigned to many Categories.

Database Instance Relations

SettingDescription
NameThe name to associate the relation with. Should be meaningfull, e.g. Author.
Relation TypeThe relation type, One to One or One to Many.
Related TableThe table that is being related with the main table.
Main Table KeyThe column key from the main table to use for the relation.
Related Table KeyThe column key from the related table to use for the relation.

MySQL Views

Relations can get complex and difficult to debug, an alternative simpler approach is to create a MySQL View with the relations solved and use that view as the main table.

Record Query

Fetches a single record from the table and resolves to a dynamically generated record type based on the table schema.

Database Record Query

SettingDescriptionDefaultDynamic
FiltersThe list of filter conditions applied to the query.[]
OrderingThe list of ordering conditions applied to the query.[]
RandomShould the ordering be randomized ignoring any ordering condition.false
StartThe offset applied to the query.1
CacheThe duration in seconds before the cache is invalidated and the query re-executed.3600

Records Query

Fetches records from the table and resolves to a dynamically generated list of record type based on the table schema.

Database Records Query

SettingDescriptionDefaultDynamic
FiltersThe list of filter conditions applied to the query.[]
OrderingThe list of ordering conditions applied to the query.[]
RandomShould the ordering be randomized ignoring any ordering condition.false
StartThe offset applied to the query.1
QuantityThe limit applied to the query.20
CacheThe duration in seconds before the cache is invalidated and the query re-executed.3600