External Database

Introduction

Use an existing external database as a data source. Currently supported external databases include MySQL, MariaDB, PostgreSQL, MSSQL, and Oracle.

Usage Instructions

Adding an External Database

After activating the plugin, you can select and add it from the "Add new" dropdown menu in data source management.

20240507204316

Fill in the information for the database you need to connect to.

20240507204820

Collection Synchronization

After establishing a connection with an external database, all collections within the data source will be read directly. External databases do not support adding collections or modifying the table structure directly. If modifications are needed, you can perform them through a database client and then click the "Refresh" button in the interface to synchronize.

20240507204725

Configuring Fields

The external database will automatically read and display the fields of existing collections. You can quickly view and configure the field's title, data type (Field type), and UI type (Field interface). You can also click the "Edit" button to modify more configurations.

20240507210537

Because external databases do not support modifying the table structure, the only available type when adding a new field is the association field. Association fields are not actual fields but are used to establish connections between collections.

20240507220140

For more details, see the Collection Fields/Overview chapter.

Field Type Mapping

NocoBase automatically maps the field types from the external database to the corresponding data type (Field type) and UI type (Field Interface).

  • Data type (Field type): Defines the kind, format, and structure of data that a field can store.
  • UI type (Field interface): Refers to the type of control used in the user interface to display and input field values.
PostgreSQLMySQL/MariaDBNocoBase Data TypeNocoBase Interface Type
BOOLEANBOOLEAN
TINYINT(1)
booleancheckbox
switch
SMALLINT
INTEGER
SERIAL
SMALLSERIAL
TINYINT
SMALLINT
MEDIUMINT
INTEGER
integer
boolean
sort
integer
sort
checkbox
switch
select
radioGroup
BIGINT
BIGSERIAL
BIGINTbigInt
sort
integer
sort
checkbox
switch
select
radioGroup
unixTimestamp
createdAt
updatedAt
REALFLOATfloatnumber
percent
DOUBLE PRECISIONDOUBLE PRECISIONdoublenumber
percent
DECIMAL
NUMERIC
DECIMALdecimalnumber
percent
currency
VARCHAR
CHAR
VARCHAR
CHAR
string
password
uuid
nanoid
input
email
phone
password
color
icon
select
radioGroup
uuid
nanoid
TEXTTEXT
TINYTEXT
MEDIUMTEXT
LONGTEXT
text
json
textarea
markdown
vditor
richText
url
json
UUID-uuiduuid
JSON
JSONB
JSONjsonjson
TIMESTAMPDATETIME
TIMESTAMP
datedate
time
createdAt
updatedAt
DATEDATEdateOnlydatetime
TIMETIMEtimetime
-YEARdatetime
CIRCLEcirclejson
circle
PATH
GEOMETRY(LINESTRING)
LINESTRINGlineStringJson
lineString
POINT
GEOMETRY(POINT)
POINTpointjson
point
POLYGON
GEOMETRY(POLYGON)
POLYGONpolygonjson
polygon
GEOMETRYGEOMETRY--
BLOBBLOBblob-
ENUMENUMenumselect
radioGroup
ARRAY-arraymultipleSelect
checkboxGroup
BITBIT--
SETSETsetmultipleSelect
checkboxGroup
RANGE---

Unsupported Field Types

Unsupported field types are displayed separately. These fields require development adaptation before they can be used.

20240507221854

Filter Target Key

Collections displayed as blocks must have a Filter target key configured. The filter target key is used to filter data based on a specific field, and the field value must be unique. By default, the filter target key is the collection's primary key field. For views, collections without a primary key, or collections with a composite primary key, you need to define a custom filter target key.

20240507210230

Only collections that have a filter target key configured can be added to the page.

20240507222827