Integrate MongoDB & SQL data with a single REST API
- 1. A Shot of Espresso for Your Enterprise Apps
1
The Fastest Way to Create
Backend Services Across Data Sources
- 3. Agenda
• Espresso Logic
• SQL vs Mongo concepts & use cases
• Building a secure REST Integration Server
• Blending MongoDB with SQL
• Q&A
3
- 4. Espresso Logic
Declarative development for data-intensive apps
• RESTful API
• Reactive programming and JavaScript for logic
• Fine grain role-based security
• Application lifecycle facilities
- 6. Today’s world - Heterogeneous data
• SQL
• JSON
• EDI
• CSV
• XML
• SOAP
• ODATA
<book id="bk101">
<author>Gambardella,
Matthew</author>
<title>XML Developer's
Guide</title>
<genre>Computer</genre>
</book>
<workspace>
<atom:title>Default</atom:title>
<collection href="Categories">
<atom:title>Categories</atom:title>
</collection>
<collection href="CustomerDemographics">
<atom:title>CustomerDemographics</atom:title>
</collection>
<collection href="Customers">
<atom:title>Customers</atom:title>
</collection>
- 7. SQL vs MongoDB Concepts
SQL Terms/concepts MongoDB Terms/concepts
DATABASE DATABASE
TABLE COLLECTION
ROW DOCUMENT OR BSON DOCUMENT
COLUMN FIELD
INDEX INDEX
TABLE JOINS EMBEDDED DOCUMENTS AND
LINKING
PRIMARY KEY PRIMARY KEY
TRANSACTIONS
BEGIN, COMMIT/ROLLBACK
NA
SCHEMA NA
- 8. Language Syntax is different
8
SQL Terms, Function, Concepts MongoDB Aggregation Operators
WHERE $match
GROUP BY $group
HAVING $match
SELECT $project
ORDER BY $sort
LIMIT $limit
SUM $sum
COUNT $count
JOIN No direct support
- 9. Use Cases for MongoDB & SQL
Drivers: Scale, Size, Cost Drivers: ACID, Reporting, Familiarity
MongoDB
– Big Data – Business
Intelligence
– New Mobile Apps (high
volume reads)
– Logs and Web events
– Product and Image catalogs
– Content Management
SQL Database
– Financial and Accounting
– Legacy Business Applications
– Anything that involves $$$
- 10. Blending MongoDB and SQL
SQL and MongoDB
– Financial and Sales transactions with archived history
– Account and Payment Processing
– Shopping Carts and Order Entry
How do we do this?
- 11. We need a RESTful Server
http://eval.espressologic.com/rest/sample/demo/v1/
Multiple Data Sources
Endpoints:
/customer/{id}
/employee/{id}
/customerWithOrders
/product/{id}
{
“@metadata": {
"checksum": "A:6c253d56830572ea",
},
"name": "Alpha and Sons",
"balance": 0,
"credit_limit": 9000
}
…. so you need to build a REST Server
- 12. Building a secure REST Integration Server
Apache Tomcat
Hibernate (JPA)
Entity Framework/WCF
JDBC Driver
Jersey/Jackson Logging
Library (log4J)
Web Hosting
Servlet API
Identity Security services
JavaScript engine
Configuration Properties
User & roles definitions,
SQL and NoSQL Server connections
Declarative (Reactive) Rules
Role-based Access Control
Schema ORM Model
Security tokens
REST API definitions
Event Code
metadata
Now we need to host this…
- 13. Fast & Easy Way
SQL
“
name": "Alpha and Sons",
"balance": 4484,
"MongoOrders": [
{
"_id": {
"$oid": "53d64c59a32268822c09e994"
},
"order_number": 1,
"amount_total": 1079,
"salesrep_id": 2,
"items": [
{
"_id": {
"$oid": "53d64c38a32268822c09e746"
},
"lineitem_id": 1,
"product_number": 4,
"amount": 600
},
- 16. Step 1 – Connect Existing SQL Database
SQL
Instant RESTful Endpoints
• Tables
• Views
• Stored Procedures
- 17. Step 2- Creating REST endpoints
1. Name a new resource
2. Specify the SQL table
3. Add Mongo sub-documents
- 18. Step 3- Blending MongoDB with SQL
Point and Click
1. Select Parent SQL
2. Add Sub Document
3. Enter MongoDB Server,
database, and collection
4. Specify ‘join’
Test in REST Lab
- 21. Step 4 – Customize your API
• Alias Attributes
(rename)
• Change format
• Select/Project columns
to include
• Add new virtual
columns (Row Event)
• Filter/Sort
• Limit/Offset (paging)
- 23. What’s Next
• Business logic via reactive programming & JavaScript
• Adding authentication to your new REST Server
• Setting up users and roles
• Column and row level security
- 24. Summary
• Applications today need to support multiple databases
• Building a Rest Integration Server
• With Espresso, need just four simple steps
to join Mongo and SQL in a single REST API
– Connect to multiple databases
– Create new REST endpoints
– 'Join' Mongo and SQL with point-and-click
– Test the REST API
- 25. Next steps
• Webinar next week
From specs to an app: 10X faster with reactive programming
• Sign up for a free trial – Build a proof of concept with your data
Let us help you connect to your data
- 26. Thank You
Questions????
www.espressologic.com
Technical: tyler@espressologic.com
Business: ron@espressologic.com
Editor's Notes
- New Company with a long history of delivering enterprise business applications
- Introduction of topic, company, and people
- Long history of Logic on different platforms -VB/Stored Procs, CORBA, J2EE, Hibernate, REST
- Shown JSON, XML, SQL TDS, and ODATA – many formats and translations to a single REST JSON API
- Many similarities and a few differences – NO SCHEMA & No Transactions are big ones
- Language syntax differences – pipeline (programmer does the order of operations in MongoDB)
- Scalable (replica, sharding, clusters) – split slides
(Atomicity, Consistency, Isolation, Durability)
- REST is simply and easy to consume (hide abstraction). Great for Mobile apps and for public consumption of information (see. Healthcare.gov) -- Need to be a REST Server
- A lot to learn and a lot to build (left side) then you need to figure out where and how to maintain and store the meta data. This is before you pick your Mobile front-end
- Clock/race car
- A Complete stack with a UI to edit and manage every aspect of building and delivery of RESTful API’s connect to SQL and MongoDB (as well as any backend service)
- Demo starts here
- Point and Click, Alias and Format columns, filters, sorts (Live Demo) – No Jagging
- Live Demo
- Select any table, view, stored procedure, or user-defined resource - Live Demo
- Instant documentation using Swagger Spec
- Security, Business Logic
- Connect, Create resources, test (mongo and sql) in single REST
- Architecture
REST Resources
Data Integration
Security
Logic Tutorial
Live Browser (Instant View UI)