JSON as a SQL Datatype
-
Upload
robert-sell -
Category
Technology
-
view
157 -
download
2
Transcript of JSON as a SQL Datatype
![Page 1: JSON as a SQL Datatype](https://reader035.fdocuments.in/reader035/viewer/2022062218/58ed91451a28abdf218b46cb/html5/thumbnails/1.jpg)
JSON in a SQL WorldBy Robert Sell
Twitter: @DukeOfNodeLinkedin: http://www.linkedin.com/in/robert-sell
![Page 2: JSON as a SQL Datatype](https://reader035.fdocuments.in/reader035/viewer/2022062218/58ed91451a28abdf218b46cb/html5/thumbnails/2.jpg)
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
![Page 3: JSON as a SQL Datatype](https://reader035.fdocuments.in/reader035/viewer/2022062218/58ed91451a28abdf218b46cb/html5/thumbnails/3.jpg)
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”}}
![Page 4: JSON as a SQL Datatype](https://reader035.fdocuments.in/reader035/viewer/2022062218/58ed91451a28abdf218b46cb/html5/thumbnails/4.jpg)
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
![Page 5: JSON as a SQL Datatype](https://reader035.fdocuments.in/reader035/viewer/2022062218/58ed91451a28abdf218b46cb/html5/thumbnails/5.jpg)
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
![Page 6: JSON as a SQL Datatype](https://reader035.fdocuments.in/reader035/viewer/2022062218/58ed91451a28abdf218b46cb/html5/thumbnails/6.jpg)
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
![Page 7: JSON as a SQL Datatype](https://reader035.fdocuments.in/reader035/viewer/2022062218/58ed91451a28abdf218b46cb/html5/thumbnails/7.jpg)
JSON Comes to SQL
• JSON in Postgres 9.4 and JSONB in 9.5• MySQL in 5.7• T-SQL in 2016
![Page 8: JSON as a SQL Datatype](https://reader035.fdocuments.in/reader035/viewer/2022062218/58ed91451a28abdf218b46cb/html5/thumbnails/8.jpg)
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
![Page 9: JSON as a SQL Datatype](https://reader035.fdocuments.in/reader035/viewer/2022062218/58ed91451a28abdf218b46cb/html5/thumbnails/9.jpg)
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)