SlideShare a Scribd company logo
RagnarDB SQL
KAI LU AND PATRICK JENNINGS
Project Goals
 Create an Object Oriented SQL Querying plugin in Gosu
 Interpret Data Definition Files
 Create Types based on these descriptions
 Add Object Oriented Functionality to these types
 Add support similar to that in more common languages
 Compare to Java Object Oriented Querying Library (jOOQ)
Parsing
 Recursive descent parsing
 Top Down Approach
 Testing for correctness via ANTLR
 Lexing code into Tokens
Parsing
DDL CreateTable
ColumnDefinition
Constraint
 Extracting data we care about
 A DDL File contains many tables
 Tables contain many Column Definitions and many Constraints
Type system Metaprogramming
 Information from the parser is loaded into the Gosu Typeloader at
Compile time
 Types for each table are created
 Methods related to tables can also be invoked statically
 We use this to support custom query building
Query Construction
 At this point, our new classes still don’t do much
 So we added support for construction of SQL queries
 Queries can be called off of constructed types statically
 Insert instances of types into database
 SQLConstraint Class describes clauses in SQL statements
Query Functionality
 Select Statements
 Specify Rows returned
 Join Statements, On statements
 Recursive Support for multiple Joins
 Where Statements
 Is In Constraints
 SQL SubQueries
 Is Equal to / Greater, Less than, etc
 Is Like
 Boolean Logic For multiple constraints
 Order By
 Limit Clauses
Fine-grain control for complex
queries
 SELECT name, phone, email, address FROM customers AS
contactInfo WHERE country = ‘US’;
 WITH RECURSIVE destinations(city, country) AS (
SELECT city, country FROM connections WHERE start = ‘Foster City’
UNION ALL
SELECT city, country FROM connections WHERE start = city
)
SELECT * FROM destinations
 SELECT game FROM ign WHERE rating > (SELECT rating FROM ign
WHERE game = ‘Tales Of Symphonia’)
SQL Files are now Gosu Types
 PresentationQuery1.sql:
SELECT * FROM Contacts WHERE Name = ‘Kai Lu’;
->
var kais = MyQuery.execute()
 for(kai in kais){
print(kai.Name)
}
->
Kai Lu
ID Name Email Age
1 Patrick Jennings pjennings 19
2 Kai Lu klu 19
3 Luca Boasso lboasso ??
4 Kyle Moore kmoore ??
Contacts
Query Execution:
Parameterization
 @variableName:variableType exposes a parameter of type
variableType, called variableName to the plugin
Applications
Moving Forward
 Full Set of Data Types (arrays, date/time, XML)
 Transactions and multiple queries
 Connection management
 Cache management
 Error Handling
 Resolving the N+1 queries problem

More Related Content

Viewers also liked

Reunião Geral CBAN 04
Reunião Geral CBAN 04 Reunião Geral CBAN 04
Reunião Geral CBAN 04
Giana Araujo
 
Nº2 Volumen 12 Getahun et al
Nº2 Volumen 12 Getahun et alNº2 Volumen 12 Getahun et al
Nº2 Volumen 12 Getahun et al
Angelica Getahun
 
Removals to germany
Removals to germanyRemovals to germany
Removals to germany
Alana alex
 
Big Cats of Belize: Five Beautiful Species
Big Cats of Belize: Five Beautiful SpeciesBig Cats of Belize: Five Beautiful Species
Big Cats of Belize: Five Beautiful Species
Chaa Creek Resort
 
Citazione dei documenti e bibliografia nella tesi di laurea di ambito giuridi...
Citazione dei documenti e bibliografia nella tesi di laurea di ambito giuridi...Citazione dei documenti e bibliografia nella tesi di laurea di ambito giuridi...
Citazione dei documenti e bibliografia nella tesi di laurea di ambito giuridi...
Evelina Ceccato
 
Ricerca dell'informazione specialistica nelle banche dati e nel web
Ricerca dell'informazione specialistica nelle banche dati e nel webRicerca dell'informazione specialistica nelle banche dati e nel web
Ricerca dell'informazione specialistica nelle banche dati e nel web
Evelina Ceccato
 
Imagen oncologia1
Imagen oncologia1Imagen oncologia1
Imagen oncologia1
Mony Fel
 
Lipoprotein metabolism - (transport of lipids in the Blood)
Lipoprotein metabolism - (transport of lipids in the Blood)Lipoprotein metabolism - (transport of lipids in the Blood)
Lipoprotein metabolism - (transport of lipids in the Blood)
Ashok Katta
 
Imagenesexplorarecien1
Imagenesexplorarecien1Imagenesexplorarecien1
Imagenesexplorarecien1
Mony Fel
 

Viewers also liked (9)

Reunião Geral CBAN 04
Reunião Geral CBAN 04 Reunião Geral CBAN 04
Reunião Geral CBAN 04
 
Nº2 Volumen 12 Getahun et al
Nº2 Volumen 12 Getahun et alNº2 Volumen 12 Getahun et al
Nº2 Volumen 12 Getahun et al
 
Removals to germany
Removals to germanyRemovals to germany
Removals to germany
 
Big Cats of Belize: Five Beautiful Species
Big Cats of Belize: Five Beautiful SpeciesBig Cats of Belize: Five Beautiful Species
Big Cats of Belize: Five Beautiful Species
 
Citazione dei documenti e bibliografia nella tesi di laurea di ambito giuridi...
Citazione dei documenti e bibliografia nella tesi di laurea di ambito giuridi...Citazione dei documenti e bibliografia nella tesi di laurea di ambito giuridi...
Citazione dei documenti e bibliografia nella tesi di laurea di ambito giuridi...
 
Ricerca dell'informazione specialistica nelle banche dati e nel web
Ricerca dell'informazione specialistica nelle banche dati e nel webRicerca dell'informazione specialistica nelle banche dati e nel web
Ricerca dell'informazione specialistica nelle banche dati e nel web
 
Imagen oncologia1
Imagen oncologia1Imagen oncologia1
Imagen oncologia1
 
Lipoprotein metabolism - (transport of lipids in the Blood)
Lipoprotein metabolism - (transport of lipids in the Blood)Lipoprotein metabolism - (transport of lipids in the Blood)
Lipoprotein metabolism - (transport of lipids in the Blood)
 
Imagenesexplorarecien1
Imagenesexplorarecien1Imagenesexplorarecien1
Imagenesexplorarecien1
 

Similar to MidtermDemo

Querydsl fin jug - june 2012
Querydsl   fin jug - june 2012Querydsl   fin jug - june 2012
Querydsl fin jug - june 2012
Timo Westkämper
 
My sql
My sqlMy sql
215 oodb
215 oodb215 oodb
215 oodb
trhtom90
 
Ch3rerevised
Ch3rerevisedCh3rerevised
Ch3rerevised
Mohammed Nazer M
 
chapter9-SQL.pptx
chapter9-SQL.pptxchapter9-SQL.pptx
chapter9-SQL.pptx
Yaser52
 
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdfDBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
AbhishekKumarPandit5
 
PostgreSQL Tutorial for Beginners | Edureka
PostgreSQL Tutorial for Beginners | EdurekaPostgreSQL Tutorial for Beginners | Edureka
PostgreSQL Tutorial for Beginners | Edureka
Edureka!
 
CS 542 Introduction
CS 542 IntroductionCS 542 Introduction
CS 542 Introduction
J Singh
 
PostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | EdurekaPostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | Edureka
Edureka!
 
Sql Summit Clr, Service Broker And Xml
Sql Summit   Clr, Service Broker And XmlSql Summit   Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And Xml
David Truxall
 
NoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualNoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 Virtual
Werner Keil
 
MIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome MeasuresMIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome Measures
Steven Johnson
 
Winter course
Winter courseWinter course
Winter course
Plentynum Technologies
 
SQL for Web APIs - Simplifying Data Access for API Consumers
SQL for Web APIs - Simplifying Data Access for API ConsumersSQL for Web APIs - Simplifying Data Access for API Consumers
SQL for Web APIs - Simplifying Data Access for API Consumers
Jerod Johnson
 
Avoiding Bad Database Surprises: Simulation and Scalability - Steven Lott
Avoiding Bad Database Surprises: Simulation and Scalability - Steven LottAvoiding Bad Database Surprises: Simulation and Scalability - Steven Lott
Avoiding Bad Database Surprises: Simulation and Scalability - Steven Lott
PyData
 
Azure Data Factory Data Flows Training (Sept 2020 Update)
Azure Data Factory Data Flows Training (Sept 2020 Update)Azure Data Factory Data Flows Training (Sept 2020 Update)
Azure Data Factory Data Flows Training (Sept 2020 Update)
Mark Kromer
 
New fordevelopersinsql server2008
New fordevelopersinsql server2008New fordevelopersinsql server2008
New fordevelopersinsql server2008
Aaron Shilo
 
[WSO2Con EU 2017] Introduction to Ballerina
[WSO2Con EU 2017] Introduction to Ballerina[WSO2Con EU 2017] Introduction to Ballerina
[WSO2Con EU 2017] Introduction to Ballerina
WSO2
 
SQL gene in NoSQL
SQL gene in NoSQLSQL gene in NoSQL
SQL gene in NoSQL
Cihan Biyikoglu
 
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptxSQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SabrinaShanta2
 

Similar to MidtermDemo (20)

Querydsl fin jug - june 2012
Querydsl   fin jug - june 2012Querydsl   fin jug - june 2012
Querydsl fin jug - june 2012
 
My sql
My sqlMy sql
My sql
 
215 oodb
215 oodb215 oodb
215 oodb
 
Ch3rerevised
Ch3rerevisedCh3rerevised
Ch3rerevised
 
chapter9-SQL.pptx
chapter9-SQL.pptxchapter9-SQL.pptx
chapter9-SQL.pptx
 
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdfDBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
 
PostgreSQL Tutorial for Beginners | Edureka
PostgreSQL Tutorial for Beginners | EdurekaPostgreSQL Tutorial for Beginners | Edureka
PostgreSQL Tutorial for Beginners | Edureka
 
CS 542 Introduction
CS 542 IntroductionCS 542 Introduction
CS 542 Introduction
 
PostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | EdurekaPostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | Edureka
 
Sql Summit Clr, Service Broker And Xml
Sql Summit   Clr, Service Broker And XmlSql Summit   Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And Xml
 
NoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualNoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 Virtual
 
MIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome MeasuresMIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome Measures
 
Winter course
Winter courseWinter course
Winter course
 
SQL for Web APIs - Simplifying Data Access for API Consumers
SQL for Web APIs - Simplifying Data Access for API ConsumersSQL for Web APIs - Simplifying Data Access for API Consumers
SQL for Web APIs - Simplifying Data Access for API Consumers
 
Avoiding Bad Database Surprises: Simulation and Scalability - Steven Lott
Avoiding Bad Database Surprises: Simulation and Scalability - Steven LottAvoiding Bad Database Surprises: Simulation and Scalability - Steven Lott
Avoiding Bad Database Surprises: Simulation and Scalability - Steven Lott
 
Azure Data Factory Data Flows Training (Sept 2020 Update)
Azure Data Factory Data Flows Training (Sept 2020 Update)Azure Data Factory Data Flows Training (Sept 2020 Update)
Azure Data Factory Data Flows Training (Sept 2020 Update)
 
New fordevelopersinsql server2008
New fordevelopersinsql server2008New fordevelopersinsql server2008
New fordevelopersinsql server2008
 
[WSO2Con EU 2017] Introduction to Ballerina
[WSO2Con EU 2017] Introduction to Ballerina[WSO2Con EU 2017] Introduction to Ballerina
[WSO2Con EU 2017] Introduction to Ballerina
 
SQL gene in NoSQL
SQL gene in NoSQLSQL gene in NoSQL
SQL gene in NoSQL
 
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptxSQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
 

MidtermDemo

  • 1. RagnarDB SQL KAI LU AND PATRICK JENNINGS
  • 2. Project Goals  Create an Object Oriented SQL Querying plugin in Gosu  Interpret Data Definition Files  Create Types based on these descriptions  Add Object Oriented Functionality to these types  Add support similar to that in more common languages  Compare to Java Object Oriented Querying Library (jOOQ)
  • 3. Parsing  Recursive descent parsing  Top Down Approach  Testing for correctness via ANTLR  Lexing code into Tokens
  • 4. Parsing DDL CreateTable ColumnDefinition Constraint  Extracting data we care about  A DDL File contains many tables  Tables contain many Column Definitions and many Constraints
  • 5. Type system Metaprogramming  Information from the parser is loaded into the Gosu Typeloader at Compile time  Types for each table are created  Methods related to tables can also be invoked statically  We use this to support custom query building
  • 6. Query Construction  At this point, our new classes still don’t do much  So we added support for construction of SQL queries  Queries can be called off of constructed types statically  Insert instances of types into database  SQLConstraint Class describes clauses in SQL statements
  • 7. Query Functionality  Select Statements  Specify Rows returned  Join Statements, On statements  Recursive Support for multiple Joins  Where Statements  Is In Constraints  SQL SubQueries  Is Equal to / Greater, Less than, etc  Is Like  Boolean Logic For multiple constraints  Order By  Limit Clauses
  • 8. Fine-grain control for complex queries  SELECT name, phone, email, address FROM customers AS contactInfo WHERE country = ‘US’;  WITH RECURSIVE destinations(city, country) AS ( SELECT city, country FROM connections WHERE start = ‘Foster City’ UNION ALL SELECT city, country FROM connections WHERE start = city ) SELECT * FROM destinations  SELECT game FROM ign WHERE rating > (SELECT rating FROM ign WHERE game = ‘Tales Of Symphonia’)
  • 9. SQL Files are now Gosu Types  PresentationQuery1.sql: SELECT * FROM Contacts WHERE Name = ‘Kai Lu’; -> var kais = MyQuery.execute()  for(kai in kais){ print(kai.Name) } -> Kai Lu ID Name Email Age 1 Patrick Jennings pjennings 19 2 Kai Lu klu 19 3 Luca Boasso lboasso ?? 4 Kyle Moore kmoore ?? Contacts
  • 11. Parameterization  @variableName:variableType exposes a parameter of type variableType, called variableName to the plugin
  • 13. Moving Forward  Full Set of Data Types (arrays, date/time, XML)  Transactions and multiple queries  Connection management  Cache management  Error Handling  Resolving the N+1 queries problem