Extension Arbitrary data storage with JSON-serializable flakes


Extension Basics

Title
Arbitrary data storage with JSON-serializable flakes
Name
ckanext-flakes
Type
Public extension
Description
Create and manage independent chunks of JSON-serializable data without database migrations
CKAN versions
Download-Url (zip)
Download-Url commit date
2022-01-01
Url to repo
Category
Data Management & Quality


Background Infos

Description (long)
Show details

This extension provides a flexible entity for storing arbitrary JSON-serializable data chunks called ‘flakes’, eliminating the need for custom models and database migrations for simple data storage. Features include: create dictionary-like objects (flakes) that can store any JSON-serializable data, user-scoped namespaces (each user’s flakes visible only to them), optional global flakes for application-wide configuration (sysadmin only), named flakes with unique names per user namespace, extras field for metadata/tagging with filtered listing support, parent-child relationships with data inheritance/extension, comprehensive API with 16 actions (create/show/list/update/override/delete/lookup/validate/materialize/combine/merge/patch), validation schemas via IFlakes interface, example data factories for testing/development, flake combination and merging capabilities, partial updates with patch operations, materialization to send flake data to other API actions. Includes example plugins: flakes_rating (package rating with optional widget), flakes_feedback (package feedback with optional page). Requires Python 3.7+, compatible with CKAN 2.9-2.10. Provides IFlakes interface for registering validation schemas and example factories.

Version
0.5.0
Version release date
2022-01-01
Contact name
DataShades
Contakt email
Contact Url
(not set)


Installation Guide

Configuration hints

Install via pip:

pip install ckanext-flakes

Enable the plugin:

ckan.plugins = flakes

Run database migrations:

ckan db upgrade -p flakes

Configuration options:

Allow any user to create new flakes (default: true)

ckanext.flakes.creation.allowed = false

Allow any user to validate flakes or data (default: false)

ckanext.flakes.validation.allowed = true

Example plugins configuration:

Show rating widget on dataset pages

ckanext.flakes_rating.show_package_widget = true

Enable feedback views on dataset pages

ckanext.flakes_feedback.enable_views = true

API actions available:

  1. flakes_flake_create - Create new flake with optional name, data, parent_id, author_id, extras
  2. flakes_flake_show - Display flake by ID with optional expand from parent
  3. flakes_flake_list - List user’s flakes filtered by extras
  4. flakes_flake_update - Update existing flake’s data/parent/extras
  5. flakes_flake_override - Create or update flake by name (upsert)
  6. flakes_flake_delete - Delete flake by ID
  7. flakes_flake_lookup - Find flake by name with optional expand
  8. flakes_flake_validate - Validate flake against named schema
  9. flakes_data_validate - Validate arbitrary data against schema
  10. flakes_data_example - Generate example data using factory
  11. flakes_flake_materialize - Send flake data to another API action
  12. flakes_flake_combine - Combine multiple flakes’ data
  13. flakes_flake_merge - Combine and save multiple flakes
  14. flakes_data_patch - Partially update flake data
  15. flakes_extras_patch - Partially update flake extras

IFlakes interface for custom plugins: - get_flake_schemas() - Register validation schemas - get_flake_factories() - Register example data factories

Use cases: - User preferences/settings (theme, layout) - Todo lists/task management - Global application configuration - Temporary data storage - User-specific metadata collections

Requires ckanext-toolbelt and typing-extensions>=4.0.0 dependencies.

Plugins to configure (ckan.ini)
flakes flakes_scheming flakes_scheming_overrides flakes_rating flakes_feedback
CKAN Settings (ckan.ini)
# ckanext.flakes_rating.show_package_widget = true to the config and default # ckanext.flakes_feedback.enable_views = true to the config and default page # ckanext.flakes.creation.allowed = false # ckanext.flakes.validation.allowed = true
DB migration to be executed
flakes
<< back to Extensions