Using semi-structured data
in modern applications
Max Mether
VP Server
Agenda
• Structured and semi-structured data
• JSON in MariaDB Server
• Dynamic Columns in MariaDB Server
• Q&A
Structured and
semi-structured data
Together
What’s the point?
It’s not SQL vs NoSQL.
It’s not relational vs JSON.
What’s the point?
Your data can be structured and semi-structured.
JSON
RelationalAgility
Flexibility
Simplicity
Ubiquity
Safety
Reliability
Transactions
Data Integrity
What’s the difference?
Structured data is externally described
Semi-structured is self described
How does MariaDB Server handle it?
• Dynamic Columns
• JSON
• Virtual Columns to apply structured
• CHECK constraints with functions for validation
JSON functions
Read, write and query JSON with SQL
Structured and semi-structured data
Structured and semi-structured data
with JSON documents
Structured Semi-structured
Structured and semi-structured data
with JSON documents
Structure described by
the schema
Structure described
by the data
Example #1: definition
Example #2: create
Example #3: read (field)
Example #4: read (array)
Example #5: read (array element)
Example #6: read (object)
Example #7: query (field)
Example #8: row to JSON document
SELECT JSON_MERGE(JSON_OBJECT('name', name, 'format', format), attr) AS data
FROM products
WHERE type = 'M';
Example #9: update (field)
Example #10: update (create array)
Example #11: update (add array element)
Example #12: virtual column
Example #13: index
Example #14: constraints
Example #15: constraint violation
Dynamic Columns
Creating “per-row” columns
Dynamic Columns
“columns within columns”
Structured Semi-structured
Structured and semi-structured data
with dynamic columns
Structure described
by the schema
Structure described
by the data
Example #1: definition
Example #2: create
Example #3: read
Example #4: update
Example #5: constraints
Questions?
Thank You!

Semi Structured Data