The Guide for Time Series Data Projects is out.

Download now
Skip to content

Dynamic Database Schemas

CrateDB's SQL-NoSQL architecture enables dynamic schemas, which offers several benefits: 

  • Relational records stored as JSON documents can change structure on the fly, providing greater flexibility in handling evolving data structures and simplifying storage of large datasets.
  • JSON objects can be stored in "object" columns, which can have arbitrary numbers of attributes, nesting levels, and even arrays of objects.
  • Schemas can be enforced while still allowing for flexibility, with options to throw an error or automatically update the schema when inserting columns that weren't originally defined.
  • CrateDB Cloud supports schema evolution, which ensures dynamic schema updates when uploading multiple files simultaneously. If uploaded files have a different schema, the table schema gets automatically updated while giving you the flexibility to enable or disable this feature based on your specific requirements.

Overall, dynamic schemas make it easier to organize and structure data in a consistent, predictable way while still accommodating changing needs.
>>> CREATE TABLE IF NOT EXISTS "doc"."sensors" (
”type" TEXT,
"MachineID" TEXT,
// obj JSON
   ”MachineID” : “drill001”,
   “Sensors” : [
     { “name” : “temp1”, “value”: 21.5 },
     { “name” : “temp2”, “value”: 20.8 },
     { “name” : “accel”, “value”: 3.2 }
   “Events” : { “type” : “info”}

Product documentation

Column Policy

Additional resources

CrateDB Workshop 2023

Modeling Data in CrateDB

On-demand webinar

How to leverage CrateDB 4.8 to its full potential.

Timestamp:  8:15 – 10:53

Need to discuss your data model?