JSON in a SQL World By Robert Sell Twitter: @DukeOfNode Linkedin: http://www.linkedin.com/in/robert-sell
JSON in a SQL WorldBy Robert Sell
Twitter: @DukeOfNodeLinkedin: http://www.linkedin.com/in/robert-sell
Who Am I
• Application Architect & Data Engineer aka The Data Donkey• The guy who creates money from information via our Analytic Product• In another life I ran and managed ecommerce operations and integrated
them into IT Systems• Spent a large amount of time moving data and analyzing it so people can
make good business decisions
Popular Ways to Encode Key Value Information
• Uncomplex Tuples (CSV, TSV) => (Rob, Sell)
• XML (Soap) => <person><firstName>Rob</firstName><lastName>Sell</ lastName ></person>
• JSON (YAML, CSON) => {“person”:{“firstName”: “Rob”, “lastName”: “Sell”}}
Great JSON Properties
• First Class Support for Basic Data Types: Numbers, Strings, Boolean• First Class Support for Collections!• First Class Support for Hierarchical Structures!• Other Stuff: Readable, Not Bloated, Easily Parsible Via
Javascript
NoSQL Advantages
• Easy to get started• Loosely structured so easier to change• Easier to scale out then some SQL databases• Data is in a form closer to how the program thinks of it
Working With Data Causes a War
• Only You Can Prevent Forest Fires !!!• SQL uses set and aggregation operators to manipulate and
aggregate information• JSON and OOP languages uses map and reduce• SQL no longer equals flat data with JSON in it
JSON Comes to SQL
• JSON in Postgres 9.4 and JSONB in 9.5• MySQL in 5.7• T-SQL in 2016
Why Use JSON in SQL
• SQL is all ready your primary system for storing and transmitting data• It’s painful to make temporary classes for storage (statically typed
languages)• Decent performance with very little transformation necessary• Databases normally apply logic to information so apply logic to JSON
instead of in an application• You don’t want to lose information
Use Cases
• Data Warehousing• Need to Backup data from external platform and use it later• Don’t want to pay for ETL applications to move data to SQL
databases (Zendesk, Shopify, etc)