SlideShare a Scribd company logo
1 of 40
Obevo
NY Java SIG
You can find me at:
Github: shantstepanian
Twitter: @shantstepanian
shant.p.stepanian@gmail.com
1
Obevo: At a Glance
Database Deployment Tool handling Enterprise
Scale and Complexity
Open-sourced by Goldman Sachs in 2017
http://github.com/goldmansachs/obevo
DB2, Oracle, PostgreSQL, SQL Server, Sybase,
MongoDB
2
Agenda: Product Overview
Overview of database deployment problem space
Overview of tooling in the market
How Obevo helps
3
Agenda: Hands-on Demo
Perform a simple database deployment
Explore Java integrations: ORM and in-memory
testing
Reverse-engineering existing applications
4
DB Deployment
Problem Space
Areas under Database Deployment
Production deployments
Non-production deployments (testing)
Code maintenance and organization
Solving existing messes 😀
6
deploy with
UAT config
DB Deploy Within SDLC
Deploy your database code as you would
deploy your application code (DevOps / IaC)
7
Source
Code
Binary
Unit Test UAT Production
compile
Run in
unit test deploy with
UAT config
deploy with
Prod config
Deploying Software
DDLs
DDL Package
compile
Deploy in in-
mem DB
deploy with
Prod config
Deploying a Database
Unit Test UAT
Productio
n
What goes into a DB Deployment
Stateful Scripts
(incremental definitions)
8
Stateless Scripts
(full / rerunnable definitions)
Stateful Script Deployments
9
create table Employee (
id bigint,
name VARCHAR(32),
status INT,
PRIMARY KEY (id)
)
ALTER TABLE employee
ADD department
VARCHAR(32)
CREATE TABLE employee (
id BIGINT,
name VARCHAR(32),
status INT,
department VARCHAR(32),
salary BIGDECIMAL,
PRIMARY KEY (id)
)
ALTER TABLE employee
ADD salary BIGDECIMAL
Note: full table DDL
is never executed in
the DB
Stateless Script Deployments
10
CREATE OR REPLACE VIEW
v_emp AS
SELECT * FROM employee
CREATE OR REPLACE VIEW
v_emp AS
SELECT * FROM employee
WHERE status = 0
CREATE OR REPLACE VIEW
v_emp AS
SELECT * FROM employee
WHERE status = 1
DEPT_ID,DEPT_NAME,TYPE
1,Finance,A
2,IT,A
3,Operations,B
DEPT_ID,DEPT_NAME,TYPE
2,IT,A
3,Operations,B
4,Tax,B
5,Research,C
DEPT_ID,DEPT_NAME,TYPE
2,IT,A
3,Operations,C
4,Tax,B
5,Research,C
6,Engineering,D
Note: full object
definition in DB is
represented in code
How DB Deploy Tools Work
Scripts modeled as entries in a deploy log
Tool applies changes not yet in the deploy log
11
s1
s2
s3
Source Code
User Schema
Deploy Log
s4
s5
s1
s2
s3
s4
s5
Database
V1
package
V2
package
Changeset:
s1 s2 s3
Changeset:
s4 s5
Apply to
schema
Apply to
log
Apply to
schema
Apply to
log
Migration Script Representation
DB Deploy tools will mostly differ on the following
aspects:
▪ How to representation migrations: migrations
per file? denoting subsections within a file?
▪ How to order migrations: use a naming
convention on the file? use a separate
“command file” to list the order?
▪ Rerunnability/mutability of scripts under certain
circumstances
12
Problems with current tooling?
13
Migration File Maintenance
14
Database Schema
/table
Employee
Department
Project
Committee
/view
V_Manager
V_CommManager
V_Consultant
Java (ORM)
com.mycompany.model
Employee.java
Department.java
Project.java
Committee.java
com.mycompany.helper
ManagerView.java
CommManagerView.java
ConsultantView.java
Migrations
version1.sql
version2_emp.sql
version2_dept.sql
version3.sql
version4_1.sql
version4_2.sql
version4_3.sql
V_Manager_1.sql
V_Manager_2.sql
V_Manager_3.sql
version5.sql
Redundant view
definitions
across files
Similar structure
in database as in
code
No clear mapping
between migrations
and objects
Easy to find which file to
edit/review/clean/deploy for
a particular object
(object name == file name)
Deploy order is
explicit and clear
Change Ordering
15
create table
(...)
add foreign key
DEPARTMENT on
dept_id
Employee table
create table
(...)
add column
dept_id
Department table
create view as
select *
from EMPLOYEE
where STATUS =
1
Manager view
create view as
select *
from MANAGER
join DEPARTMENT
...
CommManager view
So why not just arrange scripts by file?
How to order
scripts?
How to discover
dependencies?
How to handle
multiple scripts for
stateful objects?
At Scale and Complexity
Various object types (tables, SPs, views, packages, ...)
Many developers, many releases
Hundreds and thousands of objects
16
At Scale and Complexity
17
At Scale and Complexity
Too complex! Why bother?
Because systems live on and still need development.
Can we work through this?
18
Obevo Overview
Obevo Approach
Let’s solve problems for all kinds of systems
20
New applications Long-lived systems
Tens/hundreds of objects Hundreds/thousands of objects
Tables only Tables, views, procedures, and more
Unit testing with in-memory databases Integration testing with regular databases
Technical Problems to Address
1) To facilitate editing, reviewing, and deploying
objects for both simple and complex projects
2) To integrate well with unit-testing and
integration-testing tools
3) To onboard existing production systems with
ease
21
Object-Based Code
Organization
Overview of the Benefits
23
Database Schema
/table
Employee
Department
Project
Committee
/view
V_Manager
V_CommManager
V_Consultant
Obevo File Representation
/table
Employee.sql
Department.sql
Project.sql
Committee.sql
/view
V_Manager.sql
V_CommManager.sql
V_Consultant.sql
Similar structure
in database as in
code Easy to find which file to
edit/review/clean/deploy for
a particular object
(object name == file name)
Can selectively deploy
subset of schema for
unit/integration testing
Revisiting the Challenges
24
create table
(...)
add foreign key
DEPARTMENT on
dept_id
Employee table
create table
(...)
add column
dept_id
Department table
create view as
select *
from EMPLOYEE
where STATUS =
1
Manager view
create view as
select *
from MANAGER
join DEPARTMENT
...
CommManager view
How to order
scripts?
How to discover
dependencies?
How to handle
multiple scripts for
stateful objects?
Break up stateful files into multiple sections
(Stateless files can remain as is)
Change Key = Object Name + Change Name
Handling Stateful Objects
25
//// CHANGE
name=”create”
create table (...)
//// CHANGE name=”FK”
add foreign key
DEPARTMENT on dept_id
Employee table
//// CHANGE name=”create”
create table (...)
//// CHANGE name=”dept_id”
add column dept_id
Department table
create view as
select *
from EMPLOYEE
where STATUS =
1
Manager view
Algorithm for ordering nodes in a graph that respect
edge dependencies
Topological Sorting for Ordering
26
EMPLOYEE.create
EMPLOYEE.FK
DEPARTMENT.create
DEPARTMENT.dept_id
V_MANAGER V_COMMMANAGER
Acceptable Orderings:
One example:
1. DEPARTMENT.create
2. DEPARTMENT.dept_id
3. EMPLOYEE.create
4. EMPLOYEE.FK
5. V_MANAGER
6. V_COMMMANAGER
Another example:
1. EMPLOYEE.create
2. V_MANAGER
3. DEPARTMENT.create
4. DEPARTMENT.dept_id
5. V_COMMMANAGER
6. EMPLOYEE.FK
... and many more
Great! Now how do we actually determine
these dependencies?
I have to parse my DBMS syntax!
Dependency Discovery
Low-tech solution: text-search for object names
Allow overriding false positives via annotations
27
create table
(...)
add foreign key
DEPARTMENT on
dept_id
Employee table
create table
(...)
add column
dept_id
Department table
create view as
select *
from EMPLOYEE
where STATUS =
1
Manager view
create view as
select *
from V_MANAGER
join DEPARTMENT
...
CommManager view
Object Names:
1. EMPLOYEE
2. DEPARTMENT
3. V_MANAGER
4. V_COMMMANAGER
Developer
Integrations
ORM Integration
ORMs can generate latest view of DDLs, but more difficulty with
migration scripts
Rely on Obevo for deployment and verification that deployed DDLs
match your ORM model
29
Java
Domain
model
Full DDL
Definitions
1) DDL gen
via
Hibernate
SchemaExport
utility
Obevo
deploy
codebase
Obevo
baseline
validation
DB
2) Convert
new objects to
Obevo format
3) Convert all
objects to
baseline
4) Verify at build-time that
deploy scripts equal baseline
5) Deploy
scripts
In-memory Testing
In-memory databases have grown in
popularity for unit testing
How to test table DDLs in unit tests?
▪ Separate DDLs for in-memory DBs
(but original DBs are not tested)
▪ Use another language from SQL for
migrations (but lose out on SQL
ecosystem)
▪ What about a translation layer?
30
In-memory DB Translation Layer
Focus on preserving the main object
structure, avoid DBMS-specific values
Use ASTs to extract clauses from SQL;
handle or ignore irrelevant sections
Limited to certain object types (e.g. tables,
views, but no procedures)
Users can fall back to custom SQL if
needed
31
create table MyTable (
ID bigint autoincrement,
DESCRIPTION text,
COUNT bigint
) lock datarows
Handle via domains:
create domain
TEXT as
LONGVARCHAR
Ignore post-table
text (usually
relates to
storage)
Ignore or handle text
after column data type
Onboarding Existing
Systems
Reverse Engineering
How to onboard this system?
33
Reverse Engineering
Prefer to reverse-engineer all objects in a schema
No strong standard API available that can generate
object definitions across DBMS types
▪ JDBC Metadata is inconsistently implemented
▪ SchemaCrawler API is a good start, but not at a
sufficient level for reverse engineering
34
Reverse Engineering - Approach
Obevo leverages vendor-provided APIs, e.g.
pg_dump, DB2LOOK, Oracle DBMS_METADATA
Most APIs only provide text output
Obevo has text-parsing logic to convert that output
to the Obevo folder structure
▪ This is an easier problem to solve than to try a
Java-based metadata API
35
Other Topics (beyond scope of talk)
Centralized permission management and cleanup
Rollback
Phased deployments
Long-running deployments and index creation
DB2 REORG handling
… and more …
36
Code Kata
Onto the Kata!
https://github.com/goldmansachs/obevo-kata/
38
THANKS!
Any questions?
You can find me at:
@shantstepanian
shant.p.stepanian@gmail.com
39
CREDITS
Special shout-outs to some useful open-sourced
products leveraged along the way:
▪ SchemaCrawler for DB API access
▪ JGraphT for graph algorithm implementations
▪ SlidesCarnival for this presentation template
40

More Related Content

Similar to Obevo: Database Deployment Tool for Enterprise Scale

Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architectureAjeet Singh
 
Trunk and branches for database configuration management
Trunk and branches for database configuration managementTrunk and branches for database configuration management
Trunk and branches for database configuration managementscmsupport
 
SQL Server - High availability
SQL Server - High availabilitySQL Server - High availability
SQL Server - High availabilityPeter Gfader
 
Be a database professional
Be a database professionalBe a database professional
Be a database professionalSayed Ahmed
 
Be a database professional
Be a database professionalBe a database professional
Be a database professionalSayed Ahmed
 
Data modeling star schema
Data modeling star schemaData modeling star schema
Data modeling star schemaSayed Ahmed
 
Db2 migration -_tips,_tricks,_and_pitfalls
Db2 migration -_tips,_tricks,_and_pitfallsDb2 migration -_tips,_tricks,_and_pitfalls
Db2 migration -_tips,_tricks,_and_pitfallssam2sung2
 
SQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesSQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesEduardo Castro
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for DevelopersSarah Dutkiewicz
 
Data Handning with Sqlite for Android
Data Handning with Sqlite for AndroidData Handning with Sqlite for Android
Data Handning with Sqlite for AndroidJakir Hossain
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part isqlserver.co.il
 
A Primer To Sybase Iq Development July 13
A Primer To Sybase Iq Development July 13A Primer To Sybase Iq Development July 13
A Primer To Sybase Iq Development July 13sparkwan
 
Kelly potvin nosurprises_odtug_oow12
Kelly potvin nosurprises_odtug_oow12Kelly potvin nosurprises_odtug_oow12
Kelly potvin nosurprises_odtug_oow12Enkitec
 
SQL/MED: Doping for PostgreSQL
SQL/MED: Doping for PostgreSQLSQL/MED: Doping for PostgreSQL
SQL/MED: Doping for PostgreSQLPeter Eisentraut
 
SQLCLR For DBAs and Developers
SQLCLR For DBAs and DevelopersSQLCLR For DBAs and Developers
SQLCLR For DBAs and Developerswebhostingguy
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hydewebhostingguy
 

Similar to Obevo: Database Deployment Tool for Enterprise Scale (20)

Sql server
Sql serverSql server
Sql server
 
Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architecture
 
Trunk and branches for database configuration management
Trunk and branches for database configuration managementTrunk and branches for database configuration management
Trunk and branches for database configuration management
 
SQL Server - High availability
SQL Server - High availabilitySQL Server - High availability
SQL Server - High availability
 
Be a database professional
Be a database professionalBe a database professional
Be a database professional
 
Be a database professional
Be a database professionalBe a database professional
Be a database professional
 
Data modeling star schema
Data modeling star schemaData modeling star schema
Data modeling star schema
 
Db2 migration -_tips,_tricks,_and_pitfalls
Db2 migration -_tips,_tricks,_and_pitfallsDb2 migration -_tips,_tricks,_and_pitfalls
Db2 migration -_tips,_tricks,_and_pitfalls
 
SQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesSQL Server 2008 Integration Services
SQL Server 2008 Integration Services
 
4 jdbc step1
4 jdbc step14 jdbc step1
4 jdbc step1
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for Developers
 
Data Handning with Sqlite for Android
Data Handning with Sqlite for AndroidData Handning with Sqlite for Android
Data Handning with Sqlite for Android
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
 
A Primer To Sybase Iq Development July 13
A Primer To Sybase Iq Development July 13A Primer To Sybase Iq Development July 13
A Primer To Sybase Iq Development July 13
 
Kelly potvin nosurprises_odtug_oow12
Kelly potvin nosurprises_odtug_oow12Kelly potvin nosurprises_odtug_oow12
Kelly potvin nosurprises_odtug_oow12
 
SQL/MED: Doping for PostgreSQL
SQL/MED: Doping for PostgreSQLSQL/MED: Doping for PostgreSQL
SQL/MED: Doping for PostgreSQL
 
SQLCLR For DBAs and Developers
SQLCLR For DBAs and DevelopersSQLCLR For DBAs and Developers
SQLCLR For DBAs and Developers
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hyde
 
MS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTUREMS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTURE
 

Recently uploaded

Call Girls Satellite 7397865700 Ridhima Hire Me Full Night
Call Girls Satellite 7397865700 Ridhima Hire Me Full NightCall Girls Satellite 7397865700 Ridhima Hire Me Full Night
Call Girls Satellite 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
Passbook project document_april_21__.pdf
Passbook project document_april_21__.pdfPassbook project document_april_21__.pdf
Passbook project document_april_21__.pdfvaibhavkanaujia
 
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full NightCall Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档208367051
 
Cosumer Willingness to Pay for Sustainable Bricks
Cosumer Willingness to Pay for Sustainable BricksCosumer Willingness to Pay for Sustainable Bricks
Cosumer Willingness to Pay for Sustainable Bricksabhishekparmar618
 
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改yuu sss
 
Mookuthi is an artisanal nose ornament brand based in Madras.
Mookuthi is an artisanal nose ornament brand based in Madras.Mookuthi is an artisanal nose ornament brand based in Madras.
Mookuthi is an artisanal nose ornament brand based in Madras.Mookuthi
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdfSwaraliBorhade
 
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一F dds
 
昆士兰大学毕业证(UQ毕业证)#文凭成绩单#真实留信学历认证永久存档
昆士兰大学毕业证(UQ毕业证)#文凭成绩单#真实留信学历认证永久存档昆士兰大学毕业证(UQ毕业证)#文凭成绩单#真实留信学历认证永久存档
昆士兰大学毕业证(UQ毕业证)#文凭成绩单#真实留信学历认证永久存档208367051
 
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024CristobalHeraud
 
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一z xss
 
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts ServiceCall Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Servicejennyeacort
 
Call In girls Bhikaji Cama Place 🔝 ⇛8377877756 FULL Enjoy Delhi NCR
Call In girls Bhikaji Cama Place 🔝 ⇛8377877756 FULL Enjoy Delhi NCRCall In girls Bhikaji Cama Place 🔝 ⇛8377877756 FULL Enjoy Delhi NCR
Call In girls Bhikaji Cama Place 🔝 ⇛8377877756 FULL Enjoy Delhi NCRdollysharma2066
 
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书zdzoqco
 
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degreeyuu sss
 
FiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfFiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfShivakumar Viswanathan
 

Recently uploaded (20)

Call Girls Satellite 7397865700 Ridhima Hire Me Full Night
Call Girls Satellite 7397865700 Ridhima Hire Me Full NightCall Girls Satellite 7397865700 Ridhima Hire Me Full Night
Call Girls Satellite 7397865700 Ridhima Hire Me Full Night
 
Passbook project document_april_21__.pdf
Passbook project document_april_21__.pdfPassbook project document_april_21__.pdf
Passbook project document_april_21__.pdf
 
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full NightCall Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
 
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
 
原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制堪培拉大学毕业证(UC毕业证)#文凭成绩单#真实留信学历认证永久存档
 
Call Girls in Pratap Nagar, 9953056974 Escort Service
Call Girls in Pratap Nagar,  9953056974 Escort ServiceCall Girls in Pratap Nagar,  9953056974 Escort Service
Call Girls in Pratap Nagar, 9953056974 Escort Service
 
Cosumer Willingness to Pay for Sustainable Bricks
Cosumer Willingness to Pay for Sustainable BricksCosumer Willingness to Pay for Sustainable Bricks
Cosumer Willingness to Pay for Sustainable Bricks
 
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
 
Mookuthi is an artisanal nose ornament brand based in Madras.
Mookuthi is an artisanal nose ornament brand based in Madras.Mookuthi is an artisanal nose ornament brand based in Madras.
Mookuthi is an artisanal nose ornament brand based in Madras.
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf
 
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
 
昆士兰大学毕业证(UQ毕业证)#文凭成绩单#真实留信学历认证永久存档
昆士兰大学毕业证(UQ毕业证)#文凭成绩单#真实留信学历认证永久存档昆士兰大学毕业证(UQ毕业证)#文凭成绩单#真实留信学历认证永久存档
昆士兰大学毕业证(UQ毕业证)#文凭成绩单#真实留信学历认证永久存档
 
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
 
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
 
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts ServiceCall Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
 
Call In girls Bhikaji Cama Place 🔝 ⇛8377877756 FULL Enjoy Delhi NCR
Call In girls Bhikaji Cama Place 🔝 ⇛8377877756 FULL Enjoy Delhi NCRCall In girls Bhikaji Cama Place 🔝 ⇛8377877756 FULL Enjoy Delhi NCR
Call In girls Bhikaji Cama Place 🔝 ⇛8377877756 FULL Enjoy Delhi NCR
 
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
 
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
 
FiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfFiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdf
 

Obevo: Database Deployment Tool for Enterprise Scale

  • 1. Obevo NY Java SIG You can find me at: Github: shantstepanian Twitter: @shantstepanian shant.p.stepanian@gmail.com 1
  • 2. Obevo: At a Glance Database Deployment Tool handling Enterprise Scale and Complexity Open-sourced by Goldman Sachs in 2017 http://github.com/goldmansachs/obevo DB2, Oracle, PostgreSQL, SQL Server, Sybase, MongoDB 2
  • 3. Agenda: Product Overview Overview of database deployment problem space Overview of tooling in the market How Obevo helps 3
  • 4. Agenda: Hands-on Demo Perform a simple database deployment Explore Java integrations: ORM and in-memory testing Reverse-engineering existing applications 4
  • 6. Areas under Database Deployment Production deployments Non-production deployments (testing) Code maintenance and organization Solving existing messes 😀 6
  • 7. deploy with UAT config DB Deploy Within SDLC Deploy your database code as you would deploy your application code (DevOps / IaC) 7 Source Code Binary Unit Test UAT Production compile Run in unit test deploy with UAT config deploy with Prod config Deploying Software DDLs DDL Package compile Deploy in in- mem DB deploy with Prod config Deploying a Database Unit Test UAT Productio n
  • 8. What goes into a DB Deployment Stateful Scripts (incremental definitions) 8 Stateless Scripts (full / rerunnable definitions)
  • 9. Stateful Script Deployments 9 create table Employee ( id bigint, name VARCHAR(32), status INT, PRIMARY KEY (id) ) ALTER TABLE employee ADD department VARCHAR(32) CREATE TABLE employee ( id BIGINT, name VARCHAR(32), status INT, department VARCHAR(32), salary BIGDECIMAL, PRIMARY KEY (id) ) ALTER TABLE employee ADD salary BIGDECIMAL Note: full table DDL is never executed in the DB
  • 10. Stateless Script Deployments 10 CREATE OR REPLACE VIEW v_emp AS SELECT * FROM employee CREATE OR REPLACE VIEW v_emp AS SELECT * FROM employee WHERE status = 0 CREATE OR REPLACE VIEW v_emp AS SELECT * FROM employee WHERE status = 1 DEPT_ID,DEPT_NAME,TYPE 1,Finance,A 2,IT,A 3,Operations,B DEPT_ID,DEPT_NAME,TYPE 2,IT,A 3,Operations,B 4,Tax,B 5,Research,C DEPT_ID,DEPT_NAME,TYPE 2,IT,A 3,Operations,C 4,Tax,B 5,Research,C 6,Engineering,D Note: full object definition in DB is represented in code
  • 11. How DB Deploy Tools Work Scripts modeled as entries in a deploy log Tool applies changes not yet in the deploy log 11 s1 s2 s3 Source Code User Schema Deploy Log s4 s5 s1 s2 s3 s4 s5 Database V1 package V2 package Changeset: s1 s2 s3 Changeset: s4 s5 Apply to schema Apply to log Apply to schema Apply to log
  • 12. Migration Script Representation DB Deploy tools will mostly differ on the following aspects: ▪ How to representation migrations: migrations per file? denoting subsections within a file? ▪ How to order migrations: use a naming convention on the file? use a separate “command file” to list the order? ▪ Rerunnability/mutability of scripts under certain circumstances 12
  • 13. Problems with current tooling? 13
  • 14. Migration File Maintenance 14 Database Schema /table Employee Department Project Committee /view V_Manager V_CommManager V_Consultant Java (ORM) com.mycompany.model Employee.java Department.java Project.java Committee.java com.mycompany.helper ManagerView.java CommManagerView.java ConsultantView.java Migrations version1.sql version2_emp.sql version2_dept.sql version3.sql version4_1.sql version4_2.sql version4_3.sql V_Manager_1.sql V_Manager_2.sql V_Manager_3.sql version5.sql Redundant view definitions across files Similar structure in database as in code No clear mapping between migrations and objects Easy to find which file to edit/review/clean/deploy for a particular object (object name == file name) Deploy order is explicit and clear
  • 15. Change Ordering 15 create table (...) add foreign key DEPARTMENT on dept_id Employee table create table (...) add column dept_id Department table create view as select * from EMPLOYEE where STATUS = 1 Manager view create view as select * from MANAGER join DEPARTMENT ... CommManager view So why not just arrange scripts by file? How to order scripts? How to discover dependencies? How to handle multiple scripts for stateful objects?
  • 16. At Scale and Complexity Various object types (tables, SPs, views, packages, ...) Many developers, many releases Hundreds and thousands of objects 16
  • 17. At Scale and Complexity 17
  • 18. At Scale and Complexity Too complex! Why bother? Because systems live on and still need development. Can we work through this? 18
  • 20. Obevo Approach Let’s solve problems for all kinds of systems 20 New applications Long-lived systems Tens/hundreds of objects Hundreds/thousands of objects Tables only Tables, views, procedures, and more Unit testing with in-memory databases Integration testing with regular databases
  • 21. Technical Problems to Address 1) To facilitate editing, reviewing, and deploying objects for both simple and complex projects 2) To integrate well with unit-testing and integration-testing tools 3) To onboard existing production systems with ease 21
  • 23. Overview of the Benefits 23 Database Schema /table Employee Department Project Committee /view V_Manager V_CommManager V_Consultant Obevo File Representation /table Employee.sql Department.sql Project.sql Committee.sql /view V_Manager.sql V_CommManager.sql V_Consultant.sql Similar structure in database as in code Easy to find which file to edit/review/clean/deploy for a particular object (object name == file name) Can selectively deploy subset of schema for unit/integration testing
  • 24. Revisiting the Challenges 24 create table (...) add foreign key DEPARTMENT on dept_id Employee table create table (...) add column dept_id Department table create view as select * from EMPLOYEE where STATUS = 1 Manager view create view as select * from MANAGER join DEPARTMENT ... CommManager view How to order scripts? How to discover dependencies? How to handle multiple scripts for stateful objects?
  • 25. Break up stateful files into multiple sections (Stateless files can remain as is) Change Key = Object Name + Change Name Handling Stateful Objects 25 //// CHANGE name=”create” create table (...) //// CHANGE name=”FK” add foreign key DEPARTMENT on dept_id Employee table //// CHANGE name=”create” create table (...) //// CHANGE name=”dept_id” add column dept_id Department table create view as select * from EMPLOYEE where STATUS = 1 Manager view
  • 26. Algorithm for ordering nodes in a graph that respect edge dependencies Topological Sorting for Ordering 26 EMPLOYEE.create EMPLOYEE.FK DEPARTMENT.create DEPARTMENT.dept_id V_MANAGER V_COMMMANAGER Acceptable Orderings: One example: 1. DEPARTMENT.create 2. DEPARTMENT.dept_id 3. EMPLOYEE.create 4. EMPLOYEE.FK 5. V_MANAGER 6. V_COMMMANAGER Another example: 1. EMPLOYEE.create 2. V_MANAGER 3. DEPARTMENT.create 4. DEPARTMENT.dept_id 5. V_COMMMANAGER 6. EMPLOYEE.FK ... and many more Great! Now how do we actually determine these dependencies? I have to parse my DBMS syntax!
  • 27. Dependency Discovery Low-tech solution: text-search for object names Allow overriding false positives via annotations 27 create table (...) add foreign key DEPARTMENT on dept_id Employee table create table (...) add column dept_id Department table create view as select * from EMPLOYEE where STATUS = 1 Manager view create view as select * from V_MANAGER join DEPARTMENT ... CommManager view Object Names: 1. EMPLOYEE 2. DEPARTMENT 3. V_MANAGER 4. V_COMMMANAGER
  • 29. ORM Integration ORMs can generate latest view of DDLs, but more difficulty with migration scripts Rely on Obevo for deployment and verification that deployed DDLs match your ORM model 29 Java Domain model Full DDL Definitions 1) DDL gen via Hibernate SchemaExport utility Obevo deploy codebase Obevo baseline validation DB 2) Convert new objects to Obevo format 3) Convert all objects to baseline 4) Verify at build-time that deploy scripts equal baseline 5) Deploy scripts
  • 30. In-memory Testing In-memory databases have grown in popularity for unit testing How to test table DDLs in unit tests? ▪ Separate DDLs for in-memory DBs (but original DBs are not tested) ▪ Use another language from SQL for migrations (but lose out on SQL ecosystem) ▪ What about a translation layer? 30
  • 31. In-memory DB Translation Layer Focus on preserving the main object structure, avoid DBMS-specific values Use ASTs to extract clauses from SQL; handle or ignore irrelevant sections Limited to certain object types (e.g. tables, views, but no procedures) Users can fall back to custom SQL if needed 31 create table MyTable ( ID bigint autoincrement, DESCRIPTION text, COUNT bigint ) lock datarows Handle via domains: create domain TEXT as LONGVARCHAR Ignore post-table text (usually relates to storage) Ignore or handle text after column data type
  • 33. Reverse Engineering How to onboard this system? 33
  • 34. Reverse Engineering Prefer to reverse-engineer all objects in a schema No strong standard API available that can generate object definitions across DBMS types ▪ JDBC Metadata is inconsistently implemented ▪ SchemaCrawler API is a good start, but not at a sufficient level for reverse engineering 34
  • 35. Reverse Engineering - Approach Obevo leverages vendor-provided APIs, e.g. pg_dump, DB2LOOK, Oracle DBMS_METADATA Most APIs only provide text output Obevo has text-parsing logic to convert that output to the Obevo folder structure ▪ This is an easier problem to solve than to try a Java-based metadata API 35
  • 36. Other Topics (beyond scope of talk) Centralized permission management and cleanup Rollback Phased deployments Long-running deployments and index creation DB2 REORG handling … and more … 36
  • 39. THANKS! Any questions? You can find me at: @shantstepanian shant.p.stepanian@gmail.com 39
  • 40. CREDITS Special shout-outs to some useful open-sourced products leveraged along the way: ▪ SchemaCrawler for DB API access ▪ JGraphT for graph algorithm implementations ▪ SlidesCarnival for this presentation template 40

Editor's Notes

  1. Motto: to solve database deployment problems no matter the complexity
  2. Take poll of audience: see who is working on different stages of a product New application vs. existing system With SDLC vs. without SDLC
  3. Let’s set the stage here for how we want to think about database deployments: as part of a regular development process. We need not dive into this too much for the presentation, as this mindset has already grown within the industry and we need not be redundant. We can quickly speak to the fact that this approach means not deploying databases via a custom UI. Some vendor products are like that. But we are focusing on those tools that can do this via code.
  4. Take poll of audience: see whose applications use these various object types. “Stateful” vs. “Stateless” refers to the kinds of migration scripts needed to maintain an object, and whether previously-run scripts against that object are still needed.
  5. For Stateful object types, the end result of an object is the accumulation of incremental modification scripts on that object (akin to incremental commits to a database or to a source code repository).
  6. Stateless object types can be recreated with a full object definition without needing to know about the previous scripts that updated the object.
  7. (Note for presenters - this slide has animations) Most DB Deploy tools are geared for Stateful objects, as those are the more prominent and tricky case to deal with (i.e. table DDLs). As such, an important rule for such stateful scripts: they cannot be modified in source code after being deployed. These scripts can thus build up over time, and so tools may provide utilies to do cleanup, but such cleanup must be done thoughtfully.
  8. Migrations are geared towards stateful objects. It is possible to represent stateless objects with stateful changes, but there is an overhead We do acknowledge that it is possible to generate a “latest” view of the database after the fact, but it requires extra steps and is not possible with all tooling. Anecdotally, for teams that haven’t onboarded to Obevo, we’ve seen some examples of teams maintaining the “database-like” structure for deployments for readability or deploying to unit tests, even though those scripts aren’t actually used for deployments. This is a redundancy that we sought to eliminate with Obevo.
  9. Presenter’s note: this slide is animated Note to audience: all SQL shown here is pseudo-sql. We condense it for readability on the slide.
  10. Presenter’s note: the last bullet point on this slide is carried over into the diagram on the next slide The problems described on the previous slides may ultimately not be too big for teams. Many folks have used tools with those patterns and it can work for them. But, at the scale with which firms can operate, in terms of number of people, systems, and years-in-existence of an application, we do think it is a worthwhile effort to solve those problems. And obviously, we want to solve those problems for complex customers and still be easily usable for simpler use cases.
  11. Presenter’s note: this diagram is intended to highlight the last bullet point on the previous slide. There is an animated entrypoint to this slide.
  12. Presenter’s note: this slide was picked up from an earlier slide
  13. Let’s revisit our earlier slide: how do we account for the problems listed here?
  14. Presenter notes: the next slide will show the breakup of these files into the migration scripts that the tool understands.
  15. https://en.wikipedia.org/wiki/Topological_sorting
  16. AST parsing is the ideal answer, but not practical given the number of database dialects to handle and the difficult to actually obtain that parsing logic. This solutions is low-tech but it works effectively well. In practice, the largest example we had for this was a system of 800 tables and 5000 stored procedures
  17. Go into details on the ORM tooling. Why deploys cannot match
  18. Side-point on Liquibase, but before diving into this, take a time-check and then a poll of the audience to see if they are familiar with it. ------------------------------------------------- A popular tool that many folks do use. Nice approach to abstract differences across DBMS types and to simplify the migration logic. However, I still prefer the SQL-based approach, as the ecosystem is far too great for that. People know SQL, documentation is written for SQL, code-generation is written for SQL. I’d be averse to recommending a whole enterprise to move wholesale to a new “sublanguage”, especially when DBMS-specific features may still be needed. That said, I do think Liquibase and Obevo could complement each other: The Obevo deploy engine is agnostic of SQL (note the MongoDB implementation). Thus, the Liquibase syntax could be a front-end to the Obevo implementation We can leverage Liquibase’s benefits of representing table changes in a DBMS-agnostic manner, while leveraging Obevo’s core engine to handle objects at scale and stateless object types elegantly I could use Liquibase to generate my test cases for Obevo across different platforms (as I do truly need to test all platforms). However, I suspect that many applications only need to handle two dialects at most: their production DB, and their in-memory DB (if they use in-memory database testing at all)
  19. We also leverage the translation functionality that the in-memory database systems provide; however, they cannot effectively provide translations on their own. Talking point: I took this translation idea from another engineer on my team that used this in their homegrown tool. It was regular-expression based. From a technical perspective, I thought it was crazy that it would work. But it was very effective in practice, and so we continued with it. Regular expressions were fragile, and so we did refactor more away from it and towards ASTs, but nonetheless, the foundation for the idea was set.