Building a custom CKAN dataset schema with ckanext-scheming

A custom CKAN dataset schema replaces the default form with fields your publishers actually need. This page explains what ckanext-scheming does, how to set it up, and what to confirm before committing.

On this page

When a custom CKAN dataset schema with ckanext-scheming is worth building

A portal team needs a custom dataset schema when the default CKAN dataset form cannot capture the metadata it must publish. ckanext-scheming is a CKAN extension that replaces that form with a schema file, where you define the fields, the presets that control how each field is entered and validated, and the resource fields that describe each file. Build one when metadata must be consistent across datasets, for example a required publisher identifier, a fixed list of themes or a date the funder insists on. A lighter approach is enough when a handful of free-text extras cover the need, because extras add key-value pairs without a schema or a custom form. The trade-off is that extras cannot be required, offer no controlled choices and map poorly to standards, so values drift between publishers.

Assign the schema to a named metadata owner, usually the person accountable for what the portal publishes. That person decides which fields exist, which are required and which pick lists are allowed. A developer on the platform team then implements those decisions in the schema file and in any theme or extension code that reads it, and keeps the file in version control so each change passes review like any other code change. Agree the sign-off path before the build starts, because a field added without an owner usually becomes a field nobody can explain during an audit or a harvest.

Before you commit, run a short gap check. List the metadata your legal, open data or funder obligations require, mark which items must be filled in for every dataset, and match each item to an existing CKAN core field. Keep anything that already has a core field in that field, and treat only the gaps as schema work. Then confirm with the implementation partner which ckanext-scheming release supports your CKAN version, because that choice constrains every later upgrade. The output of this check is the field list the metadata owner signs off, so it becomes the first version of the schema file.

Which schema field types and options fit which metadata

This table compares the field types and schema options ckanext-scheming offers for dataset metadata, the situations where each fits, and what each adds to ongoing maintenance. Read each row as a decision: choose the simplest type that keeps values consistent, then plan for the upkeep it creates. The main takeaway is that every choice list, required flag and extra dataset type becomes a schema change that must be tested and maintained.

Field or optionWhen it fitsWhat it adds to maintenance
Text fieldsTitles, contact names and notes where values vary and no fixed list appliesLittle upkeep, but free text drifts, which weakens search facets and reporting
Select and radio presetsThemes, update frequencies or licences drawn from one fixed listThe choice list must be kept current and reviewed whenever publishers ask for a new option
Checkbox and multiple select presetsDatasets that carry several controlled values, such as keywords or spatial coverageEach value needs checking in templates, the API and any downstream mapping
Date fieldsTemporal coverage, issued dates and modified datesPublishers must agree on one date format, and imported records may arrive in other formats
Resource-level fieldsFormat, language or checksum recorded on each uploaded fileA second schema to keep aligned, and publishers must complete it for every resource
Required flagsFields that must be present before a dataset can be publishedAdds publisher friction and can block bulk imports or harvested records that lack the value
Dataset typesMaps, documents or models that need their own form, fields and pagesA separate schema, templates and search behavior to test for each type
Preset names and behaviorConfirm against the ckanext-scheming release that matches your portal's CKAN version before writing the schemaUpgrades can rename presets or change validation, so pin the release and retest the schema

How to swap the default dataset form for a schema file

This sequence replaces CKAN's default dataset form with a schema file managed by ckanext-scheming. It runs from confirming the CKAN version and a matching plugin release, through a test environment, to checks that the form, API, search index and validation all reflect the new schema. The output is a tested schema file in version control that can be promoted to other environments.

  1. Confirm the CKAN version and plugin release

    Record the CKAN version the portal runs and find the ckanext-scheming release documented for that version in the project's repository. Confirm the pairing in the extension's own notes before installing anything. Check that your CKAN version is still supported under the CKAN release policy, since only the latest patch of the current minor and the previous minor receive fixes. Treat a move to a newer minor version as a separate upgrade, because minor releases may include breaking changes. Done when one CKAN version and one plugin release are written in the change record.

  2. Install the plugin in a test environment

    In a test copy of the portal, install the matching ckanext-scheming release into the CKAN virtual environment with pip, along with any extra dependencies its README lists. Before enabling the plugin, record how the default dataset form looks and behaves so you have a baseline to compare against. Then enable the plugin in ckan.plugins and restart the test instance. Ask your platform team or the extension maintainers which dependencies the release needs. Check: pip show ckanext-scheming reports the version recorded in the first step, and the default form still loads and saves a dataset.

  3. Write and version the schema file

    Write the dataset schema as a JSON file, such as dataset_schema.json (illustrative name), and keep it in the Git repository that holds the portal's deployment configuration. Define the dataset type, each field's label, its preset such as text, select or date, and which fields are required. Keep the core CKAN fields, such as title, URL name and description, so the standard workflow still works. Have a second person review the field list in a merge request. Check: the file parses as valid JSON in a linter, and the reviewed version is the one tagged for the test environment.

  4. Point the portal at the schema file

    Set scheming.dataset_schemas in the CKAN configuration file to the path of the schema file on the server, using the value documented in the extension's README. Deploy the schema file and configuration through the same pipeline you use for the rest of the portal, so the path and file contents match across test, staging and production. Let the pipeline set the path, and avoid editing it by hand on the server. Check: the deployed configuration points to the file, and the file's checksum matches the version in Git.

  5. Restart web and background services

    Restart the CKAN web processes, such as the uWSGI workers behind Nginx, and the background worker processes, so they load the plugin and the schema. Restart Solr and Redis only if your runbook requires it. Read the startup logs for schema errors, such as an unknown preset, a malformed field or a missing file path. Check: the portal starts without errors in the logs, and the dataset creation page loads with a normal response instead of a server error.

  6. Check the form and API output

    Open the dataset creation page with a test user and confirm each new field appears with its label, help text and required marker. Then call the package_show action with a test API token for a dataset that uses the new fields, and confirm the custom values appear in the response. Use a test token with the lowest permissions that can complete the check. Check: every field defined in the schema appears in both the form and the API response with the value you entered.

  7. Confirm search indexes the custom fields

    Create several test datasets with distinct values in the custom fields, then search for those values in the portal search box and with the package_search action of the Action API. Confirm that each search returns the expected datasets and that filters on the custom fields behave as your schema intends. Solr 9 is recommended for CKAN, so run this check against the same Solr version you plan to use in production. If results are missing after saving, rebuild the search index in the test environment and note the steps for production. Check: each test value returns the datasets you expect.

  8. Test that validation rejects bad input

    Submit datasets that break each rule: leave required fields empty, enter a value outside a select list, and use a date or number in the wrong format. Confirm the form shows a clear message beside each field and that the API returns a validation error for the same input. Then submit one fully valid dataset to confirm the rules allow good data through. Save these cases in the repository so they can run again after every schema change. Check: every bad input is rejected in both the form and the API, and the valid dataset is saved.

How the schema file reaches forms, the API and the search index

The schema file starts in the Git repository, where changes are reviewed and merged. The deployment pipeline copies the reviewed commit to the portal host, and ckanext-scheming loads it when CKAN starts, so the web form and the action API share the same field definitions. Saved dataset values go to PostgreSQL, and the Solr index is built from the same fields. Check two hand-offs: that the pipeline deploys only the reviewed commit, and that editors cannot change the file on the live host. Confirm the reload step against your own deployment method.

Schema file flows from repository through deployment to portal components.

How required fields and resource fields change what editors see

Required flags decide whether an editor can save a record at all, so they are the first thing to test. When a field is marked required in the schema, the form shows it as mandatory and rejects the save until a value is present. Resource fields behave differently in a way that is easy to miss. They appear on every resource form, so a required resource field is asked for each file a dataset holds, including linked files and resources added through the API. Before you mark anything required, list which fields apply to every dataset and which apply only to certain dataset types. Count how many resources a typical dataset carries, since one required resource field multiplies the entry work across all of them. Then confirm that the editors who will meet the form know where each value comes from.

The main risk is that a new required field blocks work on records created before the change. CKAN validates a record when it is saved, so an old dataset usually fails only when someone edits it. An editor who opens a dataset to correct a typo may find the save refused because of a field they never saw before. The same applies to automation. A harvester, bulk update script or upload pipeline that sends a partial record through package_update will fail for every record missing the new value, and those failures can go unnoticed until someone reads the logs. Introduce required rules in a planned order: add the field as optional, backfill existing records where the value can be sourced, require it for new datasets, and only then enforce it on edits to older records. Confirm which integrations write to your catalog and how they handle validation errors.

Test the schema against a sample of existing records before publishing it. Restore a recent production backup to a staging CKAN that runs the same schema, then select records from several groups: the oldest datasets, datasets from every organization, harvested records, datasets with many resources, and each dataset type you plan to use. Submit each record through the edit form and through an API update that mirrors your integrations, and log which ones fail and why. Failures usually fall into three groups: values that never existed, values stored under a different field name, and valid values that fail a new validator. Each group needs a decision to backfill, map or relax the rule. Publish only when the failure list is empty or every remaining failure has a named owner and a fix date. Confirm that your backup and restore process can support this test in your own environment.

Security and operational risks of changing a dataset schema

A schema change alters what editors can enter, what the API returns and what exports and harvesters see. The six risks below each name a control you can check before and after a deployment. Treat the schema file as production configuration, with the same review, secrets handling and backup discipline as the database it shapes.

Who can change and deploy the schema

The schema file decides which fields editors see and which values CKAN accepts, so a change to it changes production behavior. Require that every change arrives through a pull request that a second person approves, and that only a named deployment role can copy the approved file to a running portal. Check the branch protection settings on the repository and the permissions of the deployment account, and confirm that no change can reach the server without the approval step.

Schema changes that hide or reject data

Adding a required field, tightening a validator or removing choices from a pick list can make existing datasets fail validation the next time someone edits them. Fields dropped from the form can also stop showing values that remain stored. Before deploying, load a copy of production datasets into a staging portal, edit a sample of them, and confirm that the form still displays and saves every value. Record which datasets fail so you can fix them before users find them.

DataStore setup docs

Keeping credentials out of the schema repository

A schema file describes fields, presets and labels, so it should contain no passwords, API tokens or connection strings. Database URLs, Solr and Redis settings, DataStore write and read-only credentials and site secrets belong in the CKAN configuration loaded at startup or in your secrets manager. Run a secret scanner in continuous integration against the schema repository, and confirm that ckan.ini and any environment files holding credentials are excluded from version control.

Trust in custom plugin code

Custom validators, presets and plugin classes run inside the CKAN process with the same database and configuration access as CKAN itself. Treat them as application code: pin each extension to a specific release or commit, review changes with the same care as the schema file, and check the ckan.plugins setting before each restart. Confirm that every custom validator returns a clear error for bad input instead of silently accepting it, and that third-party extensions support your CKAN version.

Removing a field from live datasets

Deleting a field from the schema file hides it from the form, but stored values may remain in the database, the search index and any DCAT or harvest output. Confirm in your version what happens to those values before removing a field. Check which exports and downloads read the field, then decide with the data owners whether to keep the values, migrate them to another field or clear them. Write that decision into the change record and rehearse it on a staging copy first.

Backing up before every schema deployment

A schema deployment can change what editors store, and rolling back the schema file alone does not restore datasets edited under the new version. Take a PostgreSQL dump of the CKAN database and of the DataStore database immediately before each deployment, and keep the previous schema file tagged in version control. Rehearse a restore on a separate host so you know the backup works. Check that each deployment record names the backup, the schema version and the CKAN version.

How to share one schema across development, staging and production

The development environment is where a schema is first written and changed. Its repository holds the ckanext-scheming schema file, the dataset, organization and group definitions, the presets and any custom validator code, all committed to version control as the single source of truth. Each change starts on its own branch, so a reviewer can see exactly which fields, presets or required-field rules moved.

  • Schema and code together: keep the schema files and any validator code in the same repository so one commit describes one change.
  • Environment settings excluded: database credentials, site URLs, Solr and Redis hosts and API keys stay out of the repository and come from each environment's configuration.
  • One branch per change: start each new field, preset or required-field rule on its own branch and review it before merging.
  • Sample datasets: keep test datasets for each dataset type so every new field can be entered, saved and displayed.
  • Recorded merge point: note the commit or tag that is ready for staging so the same version can be deployed there.

Before a change leaves development, confirm that the schema loads without errors and that a test dataset can be created, edited and saved with every new field.

Limits to confirm before you commit to a custom schema

Each item below is a check to run in your own environment before the schema goes into production. Several depend on the CKAN version you target and on how that version's releases are scheduled. Confirm them first, because a schema that works on one minor release can need rework on the next.

Extension support for target CKAN

Start with the ckanext-scheming release line. Check that the version you plan to install declares support for your target CKAN version, and read its changelog for each release between your current CKAN version and the target. Ask the extension maintainers to confirm support for any combination you have not tested. Also check the Python version, since CKAN installs from source need Python 3.10 or newer, and treat a missing compatibility statement as a blocker until a staging copy confirms it.

Minor and patch release rules

CKAN patch releases do not break backwards compatibility and exclude schema changes and new features. Minor releases may include backwards-incompatible changes, so a custom schema that loads on one minor version can fail on the next. Plan schema changes for the move to a new minor version, and test them in staging first. Keep the patch level current, because the project supports only the latest patch of the current minor and the previous minor for fixes.

CKAN release policy

Timing of CKAN 2.12

CKAN 2.12.0 was released on August 26, 2026, alongside maintenance releases 2.11.6 and 2.10.11. If your portal runs 2.11, 2.12 is a minor upgrade, so every custom extension needs its own compatibility check. ckanext-dcat, for example, lists support for CKAN 2.10 and 2.11, so confirm each extension in your stack declares 2.12 before you commit the schema. Decide whether schema work targets 2.11 now or waits for extension support.

CKAN releases

Search and DCAT output

A custom field is stored in the dataset record, but it reaches search and DCAT output only when you configure it to. Check which fields are indexed for search and which appear in RDF output, and decide whether each maps to a DCAT-AP property. ckanext-dcat provides DCAT-AP v1, v2 and v3 schemas and RDF endpoints, so test every new field with the profile your publishers and harvesters use. Also confirm whether a search index rebuild is needed after a schema change.

ckanext-dcat repository

Migration for existing datasets

Adding a required field or changing a field type can leave existing datasets without a value that the form now asks for. Confirm which fields need a default, whether old records still validate, and whether a script must backfill values before users edit them. Test the change on a copy of production data, including harvested datasets and resources loaded into the DataStore, since those records entered through different paths. Record the backfill as a versioned step in your deployment so every environment runs the same change.

Questions buyers ask about building a CKAN dataset schema

How much does it cost to build a custom CKAN dataset schema?

Cost depends on the written scope, and DeployOpen does not publish a price list, so a quote follows from the scope agreed in writing before work starts. The main cost drivers are the number of fields, how many validation rules each field needs, whether fields must map to DCAT output, how many pick lists need controlled values, and how many environments receive the schema. Each environment adds deployment and testing work. Most of the effort is one-time: discovery with metadata owners, schema authoring, validation, testing and handover. Recurring costs appear later, when metadata changes, CKAN is upgraded or extensions need maintenance, and those can be covered by a retainer. When you ask for a quote, request an itemized list of fields, the validation and mapping work included, the environments in scope, who tests and signs off, and what is excluded.

How long does a ckanext-scheming schema project take?

Duration depends on the same drivers as cost, mainly the number of fields, how settled the metadata decisions are, and how many environments need the schema. DeployOpen does not publish fixed timelines for this work. Most engagements are fixed-scope, with timelines agreed in writing before work starts. Projects move faster when a named metadata owner can decide field names, pick lists and required fields quickly. Projects slow down when stakeholders debate definitions after the build has started. Ask for a plan with separate milestones: discovery and field inventory, a draft schema in version control, review against sample records, testing in a non-production environment, and production rollout. Each milestone should name the person who approves it. If a date matters for a reporting cycle, confirm it in the scope before you sign.

What does our team need to provide for a schema project?

Your team mainly provides decisions and access. The essentials are:

  • A named metadata owner who approves field names, definitions, pick lists and required fields.
  • Sample records from your current catalog, spreadsheets or existing datasets, including the edge cases you already know about.
  • Access to a non-production CKAN environment, the version control repository that will hold the schema, and the deployment path to staging and production.
  • Sysadmin or deployment access so the team can restart services and run a test import.
  • Review contacts from compliance, data protection or procurement if they must sign off on metadata content.

A missing metadata owner usually stalls the work, because field definitions and pick lists need decisions that the build cannot make on its own. Ask for these inputs to be listed in the written scope, with a named person responsible for each.

Can our in-house team build a CKAN schema without a partner?

Yes, an in-house team can build a schema if it has someone comfortable with CKAN configuration, Python and YAML, plus a metadata owner who can decide quickly. Simple schemas with a limited number of fields and no unusual validation are within reach of a team that already runs CKAN. The risks sit in the details: validation edge cases, DCAT alignment for RDF output and harvesting, testing against real portal records, and upgrading the extension when CKAN moves to a new minor version. Ask who will own the schema after go-live, who reviews changes and who runs each upgrade. If those answers are unclear, a fixed-scope engagement can cover the build, handover documentation and a test pass, after which your team keeps the schema. Compare both options against the same written scope before deciding.

Does a custom CKAN schema require a custom extension?

Usually not. ckanext-scheming reads a schema file to define dataset fields, presets, resource fields and required fields, so most schemas need no custom code. A custom extension becomes necessary when a rule cannot be expressed with the built-in validators and presets, such as a check across several fields, a lookup against an external register or a custom output format. Writing a validator function means adding a Python plugin to the portal, which your team must then test, version and upgrade alongside CKAN. Before committing to custom code, list each rule the business needs and check whether a built-in validator or preset already covers it. Confirm the behavior of the extension version you plan to use, because supported validators and features change between releases.

What happens to existing datasets when we change the schema?

Existing datasets stay in the database when the schema changes, but how they display depends on the change. Adding a field leaves older records empty until someone fills it in. Removing or renaming a field can hide the old values from forms and API output, so plan a migration before deleting or renaming anything. Changing a field to required may flag older records the next time they are edited, so confirm that behavior in your version. Before the change, export an inventory of current datasets, take a backup and write a script that maps old field names to new ones. Test that script on a copy of your data in a non-production environment, then run it with a dated record of what changed. Include this migration step in the written scope, with the datasets and fields it touches agreed up front.

How do CKAN upgrades affect a custom dataset schema?

Upgrades affect a custom schema through the CKAN version, the extension version and the fields the schema depends on. CKAN patch releases do not break backwards compatibility, but minor releases may include backwards-incompatible changes, so each minor upgrade needs its own test cycle. CKAN 2.12.0 was released on August 26, 2026, and the ckanext-dcat project lists support for CKAN 2.10 and 2.11, so confirm extension compatibility before planning a move to 2.12. Keep the schema in version control, pin the extension version and run each upgrade through staging with a copy of your metadata. The CKAN release policy explains which minor and patch versions still receive fixes, which sets how long a portal can wait before upgrading. Plan upgrades as part of the scope, not as a one-off task.

Why keep a CKAN schema file in version control?

Version control gives every schema change an author, a reason and a review, and it lets the same file deploy to development, staging and production. Consistency matters because a field that exists in one environment but not another can cause form errors, failed imports and harvests that behave differently across environments. Version control also provides a rollback path: if a change breaks a form, you can redeploy the previous commit. For regulated organizations, the history doubles as evidence for change management, showing who approved each metadata change and when. Store the schema, any custom validator code and deployment settings together, and require review before merging to the main branch. Ask for the repository layout, the review process and the deployment steps to be written into the scope.

Keeping the schema working through CKAN upgrades

A custom schema is only as stable as the CKAN release it runs on, so plan upgrades around the release policy before changing anything else. Patch releases do not break backwards compatibility, and they exclude schema changes and new features, so a schema that loads on one patch should load on the next patch of the same minor version. Minor releases are different: they may include backwards-incompatible changes, and CKAN targets about two minor releases a year. Treat every minor release as a possible schema break and build your upgrade calendar around that cadence. The CKAN release policy also says that only the latest patch of the current minor and the previous minor receive security and bug fixes, and an outdated patch loses support once a newer one is out, so the window for moving off an old version is limited.

Test each new minor release in staging before production is touched. Build a staging portal on the target CKAN version, deploy the schema file from version control without edits, and install the ckanext-scheming release that matches that CKAN version. Read that release's notes first, because the pairing between the two is the part most likely to fail. If the notes leave the pairing unclear, confirm it with the extension maintainers before you upgrade. Then run a short set of checks: create and edit a dataset of each dataset type, confirm that required fields and select presets still validate, load a sample dataset page and its API output, and scan the CKAN logs for scheming or plugin load errors. Repeat the checks with a copy of production data so that existing datasets are displayed and saved under the new version.

How DeployOpen scopes, builds and supports a CKAN dataset schema

DeployOpen plans, builds and documents the CKAN scheming schema as part of a fixed-scope engagement, inside your own infrastructure. The work covers which fields a dataset form collects, how presets and resource fields are defined, and how the schema is kept in version control so it can move between development, test and production portals. Scope, deliverables and timelines are agreed in writing before work starts.

How we scope

  • The written scope lists each field, preset and resource field the CKAN dataset form will collect.
  • Required fields, validation expectations and the sign-off owner are recorded before any schema file is written.
  • Engagements are fixed-scope, and ongoing support for the schema can be added as a retainer.

How we build

  • Build the schema file in a version-controlled repository your team owns, with setup steps documented alongside.
  • Test each preset and required field against sample records in a staging portal before anything reaches production.
  • Keep the schema, extension versions and install steps together so the same build runs in every environment.

How we hand over

  • Deliver the schema file, a field reference listing each field's purpose, type and required status.
  • Document how to add a field, promote a change between environments and roll back a bad schema edit.
  • Walk your platform and compliance reviewers through the schema and its test evidence before closing the engagement.

How we support

  • Support can cover schema changes, CKAN upgrades that touch the scheming extension, and regression tests after each change.
  • Retainers can include continuous testing of the portal's form and validation behavior, scoped in writing.
  • Confirm with your team who approves schema changes and how they reach each environment before support starts.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.