mtn view sql server nov 2014
TRANSCRIPT
![Page 1: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/1.jpg)
Welcome!
![Page 2: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/2.jpg)
Topics
What’s REST, and Why? (hint: not because it’s idempotent)
REST and Database
How to Create a RESTful Server - demo
Brief Look at Logic
Q & A
![Page 3: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/3.jpg)
Word for the day
DatTricityMation
REST
Connectable as Electricity
Safe, Secure and Fast
Big Job
Patterns
Boilerplate
![Page 4: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/4.jpg)
REST - what & why
![Page 5: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/5.jpg)
Why REST?
REST
1. Networked
2. SOA - any
language,
architecture
Mobile,
Web Apps,
Integration,
Cloud
ODBC
Corp
Data
![Page 6: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/6.jpg)
What’s REST?
• What’s REST: HTTP/HTTPS based
• Very Database-y
– Resources (Objects) / Operations (vs. SOAP RPCs)
– JSON: Rows & Attributes
curl www.google.com
curl -X POST
https://demodev.espressologic.com/rest/el-dev/demo/v1/product
--data-binary '[{"name": "PA", "price": 199.99}, {"name":
"PB", "price": 299.99} ]' -H "Authorization: Espresso
demo_full:1" -H "Content-type: application/json"
Payload is JSON (or XML)
Resource
server/object?filter...
Operation: GET,
POST, PUT, DELETE
![Page 7: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/7.jpg)
Pass 1 - DB and REST
Model Database REST
Domain Model Schema api: server/
Object View/Base Table,
Procedure?
Resource
Operations Select, Insert,
Update, Delete
Get, Post, Put,
Delete
Payload * JSON (XML)
![Page 8: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/8.jpg)
Pass 2 - REST Network Performance
Requirement Solution
Limit Trips ● Nested Document Results
● Update refresh data
Limit payload row size ● Projection
Limit payload row count ● Filtering
● Pagination
Non-flat results also
best for clients
(business objects)
SQL Pass-thru
not enough
Hmm
![Page 9: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/9.jpg)
Like this
FilterMulti-Level
Pagination Shape
Nested-document
resultOptimistic
Locking
![Page 10: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/10.jpg)
Creating a RESTful Server
![Page 11: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/11.jpg)
Creating REST - Framework xyz
• Create Server, Configure packages
• Define / Configure Routings
• Code Controllers
• Persistence Layer (Entity Framework, HibernateN, …)
• Code Persistence / REST logic, for each resource
– Filtering, Ordering, Projection, Pagination, Opt Locking, ...
• Code Logic and Security
• Compile, Deploy, Test, Iterate
Weeks to Months
Very Complex
![Page 12: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/12.jpg)
Creating REST - DatTricityMation
• Create REST - just connect
• Create Resources: ~ Views, plus Nested-doc, Multi-DB
• Declare Logic, Security
![Page 13: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/13.jpg)
Create Nested-Doc, Multi-DB Resources
• Joins, Logic across databases
– SQL
– REST
• Performance
– Joins - per row vs. per query
See it here
![Page 14: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/14.jpg)
Business Logic
![Page 15: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/15.jpg)
Whither Logic?
• Right Answer?
• Usual Answer??
{RESTful Server}
Shared
Network Accessible
Shared
Not Network Accessible
Not Shared
Needs REST
Excessive traffic
![Page 16: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/16.jpg)
Serious work
250 lines / table
@ 50 lines / day
Tables Days
50 250
100 500
500 2500
● Business: Slow, Not Agile, Expensive
● Devs: Mostly boring, Error-prone
● Bus Users: Obscure
![Page 17: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/17.jpg)
Logic: Reactive Programming Rules
Solves 12 transactions
● Hundreds of lines: triggers/Java
● Reduces (fat) client dev
See it here
![Page 18: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/18.jpg)
Security
Valid User?
Row/Column access?
![Page 19: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/19.jpg)
Considerations
![Page 20: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/20.jpg)
NoSQL? When and Why...
Good
Reasons
Not So Good
Archiving Data Nested-Document REST API
Log Data Integrity (structure, logic)
Unstructured Data
JSON Is JavaScript
● Mobile JS app
Was hard in SQL
● No longer
![Page 21: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/21.jpg)
World is networked… and changing
Business hates this
Conventional DatTricityMation
Upgrade Database Upgrade Database
Revise ORM
Recode REST Logic (order,
optimize)
Recode REST Security
Add rules
Compile, Deploy, Test Test Automatic reuse,
ordering, optimization
![Page 22: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/22.jpg)
One More Thing...
Your data
in 5 seconds
![Page 23: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/23.jpg)
Pretty Substantive Change
REST API, for free
Point/Click Nested-doc, Multi-DB
Logic and Security
Plus Live Browser
10X Faster
Fundamental Change
![Page 24: Mtn view sql server nov 2014](https://reader034.vdocument.in/reader034/viewer/2022042716/55aa18371a28ab42248b470c/html5/thumbnails/24.jpg)
Thank You!
max, paul, val @ espressologic.com