Integrate MongoDB & SQL data with a single REST API
-
Upload
espresso-logic -
Category
Technology
-
view
231 -
download
1
description
Transcript of Integrate MongoDB & SQL data with a single REST API
1
A Shot of Espresso for Your Enterprise Apps
The Fastest Way to Create Backend Services Across Data Sources
Espresso Logic
presents
Integrate MongoDB & SQL data with a single REST API
3
• Espresso Logic
• SQL vs Mongo concepts & use cases
• Building a secure REST Integration Server
• Blending MongoDB with SQL
• Q&A
Agenda
Espresso Logic
Declarative development for data-intensive apps
• RESTful API
• Reactive programming and JavaScript for logic
• Fine grain role-based security
• Application lifecycle facilities
Company Background
5
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>
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
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
Use Cases for MongoDB & SQL
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 $$$
Drivers: ACID, Reporting, FamiliarityDrivers: Scale, Size, Cost
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?
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
Apache TomcatHibernate (JPA)Entity Framework/WCFJDBC DriverJersey/Jackson Logging Library (log4J)Web HostingServlet APIIdentity Security servicesJavaScript engine
Building a secure REST Integration Server
metadata
Configuration PropertiesUser & roles definitions, SQL and NoSQL Server connectionsDeclarative (Reactive) RulesRole-based Access ControlSchema ORM ModelSecurity tokensREST API definitionsEvent Code
Now we need to host this…
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
},
Espresso Logic Architecture
Complete On-premise VM Appliance or Cloud Managed Service
Support for your SQL and NoSQL Database
Step 1 – Connect Existing SQL Database
SQL
Instant RESTful Endpoints• Tables• Views• Stored Procedures
Step 2- Creating REST endpoints
1. Name a new resource
2. Specify the SQL table
3. Add Mongo sub-
documents
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
Test REST Lab to Blended API
View in Live Browser
RESOURCES
TABLES
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)
API Documentation
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
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
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