Skip to content

File

The File connector is a generic connector that can be used to bulk-create datasources with corresponding metadata using a CSV, JSON, or XSD file. Use this connector when direct datasource network connectivity is not an option, or to quickly onboard exported schema snapshots.

The file can either be manually uploaded or referred to using a URL (if it is hosted and accessible over HTTP).

The connector accepts a UTF-8 encoded delimited text file using either comma (,) or semicolon (;) as the delimiter; choose one delimiter and use it consistently throughout the file. Note that fields that include the delimiter must be enclosed in double quotes.

The first row must be a header row, where the values represent the field names specified in the Custom Import Query and Custom Relationship Import Query. In addition, there is a column parent_field_path that accepts the full hierarchical field path within the same dataset, e.g. <field_name_1>::<field_name_2>. Any additional columns will be ignored.

Columns describing the dataset rather than the field — such as dataset_description, dataset_url, dataset_technical_definition, dataset_source_created and dataset_source_modified — only need a value on one row per dataset; it is applied to every row of that dataset.

The connector accepts a JSON file using the same schema as a system export returned by the Katalogue REST API.

That is, the JSON file should describe a system with a list of associated datasources. The JSON file must have at least one datasource.

// REST API system export (`/api/system/export/<system_id>`)
// System declaration
{
"system_id": "...",
"datasources": [] // required
}

Each datasource is processed for its name (required), description (optional), and associated dataset groups (required).

// Datasource declaration
{
"datasource_id": "...",
"datasource_name": "...", // required
"datasource_description": "...", // optional
"dataset_groups": [] // required
}

Each dataset group is described by a name (required), description (optional), and associated datasets (required).

// Dataset group declaration
{
"dataset_group_id": "...",
"dataset_group_name": "...", // required
"dataset_group_description": "...", // optional
"datasets": [] // required
}

Each dataset is described by a name (required), description (optional), type (optional), and associated fields.

// Dataset declaration
{
"dataset_id": "...",
"dataset_name": "...", // required
"dataset_type_name": "...", // defaults to `table`
"dataset_description": "...", // optional
"dataset_source_created": "...", // optional — see Timestamps
"dataset_source_modified": "...", // optional — see Timestamps
"fields": [] // required
}

Each field within a dataset is described by its name, type, and optional metadata.

// Field declaration
{
"field_id": 1, // optional — used as a stable reference for parent_field_id and relationships
"parent_field_id": null, // optional — field_id of the parent field (for nested/hierarchical fields)
"field_name": "...", // required
"field_source_description": "...", // optional
"field_datatype": "...", // optional
"field_datatype_length": null, // optional
"field_datatype_precision": null, // optional
"field_datatype_scale": null, // optional
"field_is_primary_key": false, // optional
"field_is_nullable": true, // optional
"field_default_value": null, // optional
"field_ordinal_position": null, // optional
"field_to_relationships": [] // optional — see below
}

Fields can be nested by setting parent_field_id to the field_id of another field in the same file. The matching happens after all fields from the import have been written to the database, so the parent does not need to pre-exist — it just needs to be present in the same import file.

field_id can be any unique string or integer within the file; it does not need to be a database ID.

field_to_relationships is an array of outgoing field-level relationships from this field to fields in other datasets. Each entry must identify the target fully:

{
"to_datasource_name": "...", // required
"to_dataset_group_name": "...", // required
"to_dataset_name": "...", // required
"to_field_name": "...", // required
"relationship_name": "...", // optional — auto-generated if omitted
"relationship_ordinal_position": 1 // optional — defaults to 1
}

The connector accepts one well-formed XML Schema Definition file and imports the schema as one Katalogue dataset.

To get started, download the XSD connector example .

The example demonstrates supported elements, attributes, reusable types, groups, enumerations, lists, inheritance, simple content, documentation, and XML comments.

Because one XSD file creates one dataset, its location and Katalogue context must be supplied in the connection form:

Connection fieldPurpose
File TypeSet to XSD.
Import File URLURL or local path to the XSD file. Also used as the dataset name.
Datasource NameDatasource under which the dataset is created.
Dataset Group NameDataset group under which the dataset is created.

The connector uses Folder as the datasource type and markup as the dataset type.

The connector identifies XML Schema declarations through the W3C XML Schema namespace URI, not through a particular prefix.

These schema roots are therefore equivalent:

<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<schemaDefinition:schema
xmlns:schemaDefinition="http://www.w3.org/2001/XMLSchema">

QName-valued attributes such as type, base, and ref are resolved using their in-scope namespace declarations.

Named declarations are identified by expanded name:

{namespace-uri}localName

This allows declarations with the same local name in different namespaces to remain distinct within the loaded schema document.

The connector expands each global XSD element into a root Katalogue field.

Nested elements produce nested Katalogue fields. XSD attributes become child fields using an @ prefix:

Customer
├── Version
└── @Version

The @ prefix distinguishes an attribute from a child element with the same local name.

The connector processes parents before children and rejects duplicate final field paths.

The current single-document connector supports:

  • Global elements
  • Global element references
  • Named and inline complexType
  • Named and inline simpleType
  • sequence, choice, and all
  • complexContent/extension
  • simpleType/restriction
  • simpleContent/extension
  • simpleContent/restriction
  • Named and nested group references
  • Named and nested attributeGroup references
  • Local attributes
  • Built-in XSD datatypes
  • Named simple-type restriction chains
  • enumeration
  • list
  • Restriction facets
  • Abstract complex types and concrete implementations
  • Optional, repeating, and nillable elements
  • Optional and required attributes
  • Recursive complex types
  • Multiple global elements

A complex type may extend another named complex type:

<xs:complexType name="CustomerType">
<xs:complexContent>
<xs:extension base="tns:PartyType">
<xs:sequence>
<xs:element
name="CustomerId"
type="tns:IdentifierType"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

The inherited fields are imported before the locally declared fields.

complexContent/restriction is not currently supported. See Limitations.

Named model groups are expanded transparently:

<xs:group name="AuditFields">
<xs:sequence>
<xs:element
name="CreatedDateTime"
type="xs:dateTime"/>
<xs:element
name="CreatedBy"
type="xs:string"
minOccurs="0"/>
</xs:sequence>
</xs:group>
<xs:group ref="tns:AuditFields"/>

The group does not become a Katalogue field. Its contained elements become children of the surrounding field.

The connector supports:

  • Nested group references
  • Occurrence constraints on group references
  • Choice semantics inside groups
  • Reuse on independent schema branches
  • Circular-reference detection
  • Clear errors for unresolved group references

An optional group makes its contained fields nullable. A repeating group makes its contained fields repeating.

Named attribute groups are also expanded transparently:

<xs:attributeGroup name="CommonAttributes">
<xs:attribute
name="version"
type="xs:string"
use="required"/>
<xs:attribute
name="language"
type="xs:language"/>
</xs:attributeGroup>
<xs:attributeGroup ref="tns:CommonAttributes"/>

The resulting fields are:

@version
@language

Nested attribute groups, declaration order, independent reuse, unresolved references, and circular references are handled explicitly.

simpleContent represents an XML element containing a scalar value and attributes.

Example:

<xs:complexType name="AmountType">
<xs:simpleContent>
<xs:extension base="tns:PriceType">
<xs:attribute
name="currency"
type="xs:string"
use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

An instance may look like:

<Price currency="SEK">125.50</Price>

Katalogue represents it as:

Price decimal
└── @currency string, required

Both simpleContent/extension and simpleContent/restriction support:

  • Built-in XSD base types
  • Named simple-type bases
  • Local attributes
  • Attribute groups
  • Inherited and local facets
  • Enumeration narrowing

A repeating XML element imports as array:

<xs:element
name="Item"
type="tns:ItemType"
maxOccurs="unbounded"/>

An XSD list imports as list:

<xs:simpleType name="TagsType">
<xs:list itemType="xs:string"/>
</xs:simpleType>

These represent different XML structures:

  • An array consists of repeated XML elements.
  • A list is one XML value containing whitespace-separated items.

Abstract types and concrete implementations

Section titled “Abstract types and concrete implementations”

If an element declares an abstract complex type, the connector expands its concrete derived implementations.

Payment
├── CardPaymentType
└── InvoicePaymentType

Concrete implementations are represented as nullable type alternatives because an individual XML instance uses one implementation rather than all of them.

Recursive complex types are represented as finite hierarchies.

The first occurrence is expanded normally. When the same type is encountered again on the active expansion path, the connector:

  1. Retains the real field.
  2. Retains the real complex datatype.
  3. Marks the semantic node as recursive.
  4. Stops expanding its children.

Conceptually:

CreatedFrom: IdentityHistory
├── EstimateIdentity
└── CreatedFrom: IdentityHistory [recursive reference]

The connector does not expand a recursive schema to an arbitrary fixed depth and does not add a synthetic circular-reference field.

Element nullability can result from

  • ="0"
  • nillable="true"
  • An optional surrounding compositor or group
  • An alternative inside choice
  • A concrete implementation being one of several type alternatives

An attribute is nullable unless it declares:

use="required"

Repetition can result from the element itself or from a surrounding repeating compositor or group.

Four facets populate Katalogue datatype properties. Other facets, such as pattern or minInclusive, are not imported:

XSD facetKatalogue property
lengthDatatype length
maxLengthDatatype length
totalDigitsDatatype precision
fractionDigitsDatatype scale

When a derived restriction repeats a facet kind, the most-derived value is used for the Katalogue datatype property.

Example:

Inherited maxLength: 20
Local maxLength: 12
Katalogue length: 12

Descriptions are extracted from standard annotation/documentation declarations:

<xs:element name="MessageId" type="xs:string">
<xs:annotation>
<xs:documentation>
Unique identifier for the message.
</xs:documentation>
</xs:annotation>
</xs:element>

Without documentation, the XML comments directly before a declaration become its description:

<!--
Unique identifier for the message.
Assigned by the sending system.
-->
<!-- Never reused. -->
<xs:element name="MessageId" type="xs:string"/>
  • Every comment directly before the declaration is used, each on its own line. Line breaks inside a comment are kept, and empty lines are removed.
  • A comment belongs to the declaration that follows it, so write it above the element or attribute it describes, not after it on the same line.
  • A comment that starts with < or ends with > is commented-out markup, such as <!-- No longer used <xs:element name="Old"/> -->. It is skipped, together with any comments directly before it, since they describe the removed declaration.
  • When a declaration has documentation, the first xs:documentation is its description and its comments are not used.

A field without a description of its own takes the description of the global element it references, and otherwise the description of its type.

Enumeration values are not appended to the field description and are not yet persisted as Katalogue Attribute Values.

The following constructs are intentionally deferred:

  • complexContent/restriction
  • include
  • import
  • union
  • Global attribute references
  • redefine
  • override
  • Configurable parser and schema-set resource limits

A complex-content restriction defines a narrower effective content model. It cannot be represented correctly by simply merging all inherited fields with the locally declared fields, because that may retain elements or attributes that the restricted type excludes.

The connector rejects complexContent/restriction rather than importing an inaccurate hierarchy.

The connector processes one XSD document. All referenced declarations must therefore be present in that document.

External schema loading would require path and URI resolution, namespace-aware schema-set merging, dependency-cycle detection, duplicate handling, and resource limits.

Choice alternatives are flattened beneath their semantic parent. Katalogue does not currently persist the rule that only one alternative may occur.

Repeating groups are flattened into their contained fields. Katalogue does not retain tuple-like grouping between corresponding child values in each runtime occurrence.

Some XSD semantics are retained by the connector but do not currently have a dedicated persistence target in Katalogue, including:

  • Type category
  • Collection and list item type
  • Type-alternative and synthetic-node flags
  • Recursive-reference metadata
  • Nullability causes
  • Structured description provenance
  • Enumeration values
  • Complete inherited and local facet provenance

The following downloadable examples can be used as starting points for file connector imports:

  • sample database with relationships: [CSV, JSON, JSON light]
  • hierarchical dataset with nested fields: [CSV]
  • respresentative XSD schema: [XSD]

Import is all-or-nothing. If any record in the file fails validation, the entire import is rejected and no data is written.

dataset_source_created and dataset_source_modified accept any timestamp PostgreSQL understands, and a value that does not state a time zone is read as UTC — so 2025-11-17T13:43:52 and 2025-11-17T13:43:52Z mean the same thing, and 2025-11-17T13:43:52+02:00 means an hour earlier. A value that is not a timestamp fails the import and names the column.

FormatChecks
CSVDelimiter must be , or ;. The header row must contain all required columns (see below). Quoted fields must have a matching closing quote.
JSONFile must be a JSON object ({...}). Must contain at least one datasource. Must produce at least one field record.
XSDFile must be well-formed XML with a schema root in the W3C XML Schema namespace. The namespace may use xs, xsd, or another declared prefix. The parsed schema must produce at least one field record and must not contain duplicate flattened field paths.

The following fields are required and must be non-empty for every record in the file, regardless of format. Validation fails immediately if any of these are missing.

FieldCSV columnJSON field
Datasource namedatasource_namedatasource_name
Dataset group namedataset_group_namedataset_group_name
Dataset namedataset_namedataset_name
Dataset typedataset_type_namedataset_type_name
Field namefield_namefield_name
Data typedatatype_namefield_datatype

The following fields must match a value that exists in the Katalogue database (case-insensitive). If the value is not found, the import fails with an error listing the allowed values.

FieldAllowed valuesDefault if omitted
datasource_type_nameValues from the Datasource Types list (e.g. Database, Folder, API, …)Other
dataset_type_nameValues from the Dataset Types list (e.g. table, view, …)(none — required)

CSV: parent_field_path must match the full path of an existing field in the same file. Paths are built by joining ancestor field names with :: (e.g. root::child). A reference to a non-existent parent fails the import.

JSON: parent_field_id is resolved after the import by matching it against field_id values from the same file. There is no pre-import validation — an unresolvable reference is silently ignored rather than causing the import to fail.

For CSV and JSON, if a relationship target is partially specified the import will fail. All four target fields must be present together:

  • to_datasource_name
  • to_dataset_group_name
  • to_dataset_name
  • to_field_name