SlideShare a Scribd company logo
Arpit Suthar
Software Consultant
Knoldus Software LLP
AgendaAgenda
1. What is Quill
2. Why Quill
3. How to use Quill
4. Slick v/s Quill
5. Demo
1. What is Quill
2. Why Quill
3. How to use Quill
4. Slick v/s Quill
5. Demo
What is QuillWhat is Quill
Quill is a library that provides a Quoted Domain Specific Language (QDSL) for Scala
which simplifies working with relational databases. It is an alternative for Slick. The
advantage of Quill is support for Compile-Time Language Integrated Queries which
allows for database access similar to Scala collections and enables compile-time
generated queries. This feature minimizes the runtime overhead of queries. Moreover, it
allows query validation during compile-time.
Why QuillWhy Quill
- Boilerplate-free
- Quoted DSL
- Compile-time query generation
- Compile-time query validation
Cont.Cont.
select s4.s56, s5.s62, s4.s60, s4.s54 from (select s6.s41 as s51, s6.s42 as s52, s6.s43 as
s53, s6.s44 as s54, s6.s45 as s55, s6.s46 as s56, s6.s47 as s57, s7.s48 as s58, s7.s49 as
s59, s7.s50 as s60 from (select s8.s34 as s41, s8.s35 as s42, s8.s36 as s43, s8.s37 as s44,
s9.s38 as s45, s9.s39 as s46, s9.s40 as s47 from (select s81.`id` as s34,
s81.`purchaser_id` as s35, s81.`product_id` as s36, s81.`total` as s37 from `sale` s81) s8
inner join (select s83.`id` as s38, s83.`name` as s39, s83.`address` as s40 from
`purchaser` s83) s9 on 1=1) s6 inner join (select s85.`id` as s48, s85.`supplier_id` as
s49, s85.`name` as s50 from `product` s85) s7 on 1=1) s4 inner join (select s87.`id` as
s61, s87.`name` as s62, s87.`address` as s63 from `supplier` s87) s5 on ((s4.s53 = s4.s58)
and (s4.s52 = s4.s55)) and (s4.s59 = s5.s61) where s4.s54 >= ?
What’s this?What’s this?
That’s actually a join query of 4 tables created by Slick of
SELECT purchaser.name, supplier.name, product.name, sale.total
FROM sale join purchaser join product join supplier
ON (sale.purchaser_id = purchaser.id AND
sale.product_id = product.id AND
product.supplier_id = supplier.id)
WHERE sale.total >= 500
Comparison:-
Lifted Embedding: 87.09 s
Plain SQL: 0.10 s
Cont.Cont.
Working with QuillWorking with Quill
1. Build.sbt =
libraryDependencies += "io.getquill" %% "quill-async" % "0.8.0"
2. Application.conf =
db.default {
host = "localhost"
port = 3306
user = "root"
database = "quill"
}
3. Database
4. case classes
And you good to go...
Cont.Cont.
case class User(id: Long, name: String, isActive: Boolean)
val Users = quote(query[User].schema(_.generated(_.id))) or
query[Users].schema(_.entity("user_table").columns(_.id -> "id_column", _.namr →
“name_col”))
lazy val ctx = new MysqlAsyncContext[SnakeCase]("db.default")
Or you can use built in Dialects
lazy val ctx = new JdbcContext[MySQLDialect, SnakeCase]("db.default")
Cont.Cont.
Naming strategy
io.getquill.naming.Literal = some_ident -> some_ident
io.getquill.naming.Escape = some_ident -> “some_ident”
io.getquill.naming.UpperCase = some_ident -> SOME_IDENT
io.getquill.naming.LowerCase = SOME_IDENT -> some_ident
io.getquill.naming.SnakeCase = someIdent -> some_ident
io.getquill.naming.CamelCase = some_ident -> someIdent
io.getquill.naming.MysqlEscape = some_ident -> `some_ident`
io.getquill.naming.PostgresEscape= $some_ident -> $some_ident
Cont.Cont.
Operations:-
1. Filter
2. Map
3. FlatMap
4. SortBy
5. Drop/take
6. GroupBy
7. Union
8. Joins
And many more...
Cont.Cont.
Insert:
val insQuery = quote(query[Contact].insert)
ctx.run(insQuery)(List(Contact(999, "987654321")))
// INSERT INTO Person (id,age) VALUES (?, ?)
Update:
val upQuery = quote {query[Person].filter(_.id == 999).update}
ctx.run(upQuery)(List(Person(999, "John", 22)))
// UPDATE Person SET id = ?, name = ?, age = ? WHERE id = 999
Delete:
val delQuery = quote {query[Person].filter(p => p.name == "").delete}
ctx.run(delQuery)
// DELETE FROM Person WHERE name = ''
Cont.Cont.
- Supports transactions
- Not supported features can be implemented by INFIX
- Supports H2, MySql, Postgres, cassandra.
Slick v/s Quill
SLICK Quill
Popularity 9.2 7.7
Activity 6.7 9.2
Repository Stars 1602
Watchers 156
Forks 376
Last Commit 9 days ago
Stars 631
Watchers 40
Forks 75
Last Commit 3 days ago
References
http://getquill.io/
http://blog.scalac.io/2016/07/21/compile-time-queries-with-quill.html
http://blog.scalac.io/2015/01/27/rough-experience-with-slick.html
Questions & Ans.fold(“you’ll get it tomorrow”)(identity)
Thanks

More Related Content

What's hot

Nervesが開拓する「ElixirでIoT」の新世界
Nervesが開拓する「ElixirでIoT」の新世界Nervesが開拓する「ElixirでIoT」の新世界
Nervesが開拓する「ElixirでIoT」の新世界
Hideki Takase
 

What's hot (20)

C#でわかる こわくないMonad
C#でわかる こわくないMonadC#でわかる こわくないMonad
C#でわかる こわくないMonad
 
Parser combinatorってなんなのさ
Parser combinatorってなんなのさParser combinatorってなんなのさ
Parser combinatorってなんなのさ
 
継承やめろマジやめろ。 なぜイケないのか 解説する
継承やめろマジやめろ。 なぜイケないのか 解説する継承やめろマジやめろ。 なぜイケないのか 解説する
継承やめろマジやめろ。 なぜイケないのか 解説する
 
RedmineのFAQとアンチパターン集
RedmineのFAQとアンチパターン集RedmineのFAQとアンチパターン集
RedmineのFAQとアンチパターン集
 
Linuxカーネルを読んで改めて知るプロセスとスレッドの違い
Linuxカーネルを読んで改めて知るプロセスとスレッドの違いLinuxカーネルを読んで改めて知るプロセスとスレッドの違い
Linuxカーネルを読んで改めて知るプロセスとスレッドの違い
 
現場で役立つシステム設計の原則
現場で役立つシステム設計の原則現場で役立つシステム設計の原則
現場で役立つシステム設計の原則
 
RxSwift コードリーディングの勘所@社内RxSwift勉強会
RxSwift コードリーディングの勘所@社内RxSwift勉強会RxSwift コードリーディングの勘所@社内RxSwift勉強会
RxSwift コードリーディングの勘所@社内RxSwift勉強会
 
WebGL Performance Tuning Tips
WebGL Performance Tuning TipsWebGL Performance Tuning Tips
WebGL Performance Tuning Tips
 
セキュアエレメントとIotデバイスセキュリティ2
セキュアエレメントとIotデバイスセキュリティ2セキュアエレメントとIotデバイスセキュリティ2
セキュアエレメントとIotデバイスセキュリティ2
 
NET 6で実装された新しいLINQ API
NET 6で実装された新しいLINQ APINET 6で実装された新しいLINQ API
NET 6で実装された新しいLINQ API
 
SDL2の紹介
SDL2の紹介SDL2の紹介
SDL2の紹介
 
今日こそ理解するHot / Cold @社内RxSwift勉強会
今日こそ理解するHot / Cold @社内RxSwift勉強会今日こそ理解するHot / Cold @社内RxSwift勉強会
今日こそ理解するHot / Cold @社内RxSwift勉強会
 
ContainerとName Space Isolation
ContainerとName Space IsolationContainerとName Space Isolation
ContainerとName Space Isolation
 
Dockerのネットワークについて
DockerのネットワークについてDockerのネットワークについて
Dockerのネットワークについて
 
マルチスレッドRxSwift @ 社内RxSwift勉強会
マルチスレッドRxSwift @ 社内RxSwift勉強会マルチスレッドRxSwift @ 社内RxSwift勉強会
マルチスレッドRxSwift @ 社内RxSwift勉強会
 
Nervesが開拓する「ElixirでIoT」の新世界
Nervesが開拓する「ElixirでIoT」の新世界Nervesが開拓する「ElixirでIoT」の新世界
Nervesが開拓する「ElixirでIoT」の新世界
 
F#入門 ~関数プログラミングとは何か~
F#入門 ~関数プログラミングとは何か~F#入門 ~関数プログラミングとは何か~
F#入門 ~関数プログラミングとは何か~
 
Grafana Lokiの Docker Logging Driver入門 (Docker Meetup Tokyo #34, 2020/01/16)
Grafana Lokiの Docker Logging Driver入門 (Docker Meetup Tokyo #34, 2020/01/16)Grafana Lokiの Docker Logging Driver入門 (Docker Meetup Tokyo #34, 2020/01/16)
Grafana Lokiの Docker Logging Driver入門 (Docker Meetup Tokyo #34, 2020/01/16)
 
できる!並列・並行プログラミング
できる!並列・並行プログラミングできる!並列・並行プログラミング
できる!並列・並行プログラミング
 
Kotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is comingKotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is coming
 

Viewers also liked

Cydcor Announces Their Second Partnership with Operation Smile
Cydcor Announces Their Second Partnership with Operation SmileCydcor Announces Their Second Partnership with Operation Smile
Cydcor Announces Their Second Partnership with Operation Smile
Cydcor
 

Viewers also liked (20)

Introduction to Quill
Introduction to QuillIntroduction to Quill
Introduction to Quill
 
Introduction to Scala JS
Introduction to Scala JSIntroduction to Scala JS
Introduction to Scala JS
 
Introduction to Shield and kibana
Introduction to Shield and kibanaIntroduction to Shield and kibana
Introduction to Shield and kibana
 
Cydcor Announces Their Second Partnership with Operation Smile
Cydcor Announces Their Second Partnership with Operation SmileCydcor Announces Their Second Partnership with Operation Smile
Cydcor Announces Their Second Partnership with Operation Smile
 
Akka streams
Akka streamsAkka streams
Akka streams
 
Getting Started With AureliaJs
Getting Started With AureliaJsGetting Started With AureliaJs
Getting Started With AureliaJs
 
Drilling the Async Library
Drilling the Async LibraryDrilling the Async Library
Drilling the Async Library
 
String interpolation
String interpolationString interpolation
String interpolation
 
Mailchimp and Mandrill - The ‘Hominidae’ kingdom
Mailchimp and Mandrill - The ‘Hominidae’ kingdomMailchimp and Mandrill - The ‘Hominidae’ kingdom
Mailchimp and Mandrill - The ‘Hominidae’ kingdom
 
Realm Mobile Database - An Introduction
Realm Mobile Database - An IntroductionRealm Mobile Database - An Introduction
Realm Mobile Database - An Introduction
 
Shapeless- Generic programming for Scala
Shapeless- Generic programming for ScalaShapeless- Generic programming for Scala
Shapeless- Generic programming for Scala
 
Kanban
KanbanKanban
Kanban
 
Introduction to Scala Macros
Introduction to Scala MacrosIntroduction to Scala Macros
Introduction to Scala Macros
 
Introduction to Java 8
Introduction to Java 8Introduction to Java 8
Introduction to Java 8
 
Mandrill Templates
Mandrill TemplatesMandrill Templates
Mandrill Templates
 
Introduction to ScalaZ
Introduction to ScalaZIntroduction to ScalaZ
Introduction to ScalaZ
 
Effective way to code in Scala
Effective way to code in ScalaEffective way to code in Scala
Effective way to code in Scala
 
ANTLR4 and its testing
ANTLR4 and its testingANTLR4 and its testing
ANTLR4 and its testing
 
Introduction to Knockout Js
Introduction to Knockout JsIntroduction to Knockout Js
Introduction to Knockout Js
 
Functors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaFunctors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In Scala
 

Similar to An Introduction to Quill

jclouds High Level Overview by Adrian Cole
jclouds High Level Overview by Adrian Colejclouds High Level Overview by Adrian Cole
jclouds High Level Overview by Adrian Cole
Everett Toews
 
ITSubbotik - как скрестить ежа с ужом или подводные камни внедрения функциона...
ITSubbotik - как скрестить ежа с ужом или подводные камни внедрения функциона...ITSubbotik - как скрестить ежа с ужом или подводные камни внедрения функциона...
ITSubbotik - как скрестить ежа с ужом или подводные камни внедрения функциона...
Vyacheslav Lapin
 

Similar to An Introduction to Quill (20)

Exploring KSQL Patterns
Exploring KSQL PatternsExploring KSQL Patterns
Exploring KSQL Patterns
 
Deploying Artifacts to Oracle Cloud with FlexDeploy
Deploying Artifacts to Oracle Cloud with FlexDeployDeploying Artifacts to Oracle Cloud with FlexDeploy
Deploying Artifacts to Oracle Cloud with FlexDeploy
 
Deploying and Operating KSQL
Deploying and Operating KSQLDeploying and Operating KSQL
Deploying and Operating KSQL
 
Bluemix paas 기반 saas 개발 사례
Bluemix paas 기반 saas 개발 사례Bluemix paas 기반 saas 개발 사례
Bluemix paas 기반 saas 개발 사례
 
Tips, Tricks & Best Practices for large scale HDInsight Deployments
Tips, Tricks & Best Practices for large scale HDInsight DeploymentsTips, Tricks & Best Practices for large scale HDInsight Deployments
Tips, Tricks & Best Practices for large scale HDInsight Deployments
 
ApacheKylin_HBaseCon2015
ApacheKylin_HBaseCon2015ApacheKylin_HBaseCon2015
ApacheKylin_HBaseCon2015
 
HBaseCon 2015: Apache Kylin - Extreme OLAP Engine for Hadoop
HBaseCon 2015: Apache Kylin - Extreme OLAP  Engine for HadoopHBaseCon 2015: Apache Kylin - Extreme OLAP  Engine for Hadoop
HBaseCon 2015: Apache Kylin - Extreme OLAP Engine for Hadoop
 
Apache Kylin Streaming
Apache Kylin Streaming Apache Kylin Streaming
Apache Kylin Streaming
 
ITB2017 - Keynote
ITB2017 - KeynoteITB2017 - Keynote
ITB2017 - Keynote
 
Session 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian MalbeufSession 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian Malbeuf
 
Clojure Conj 2014 - Paradigms of core.async - Julian Gamble
Clojure Conj 2014 - Paradigms of core.async - Julian GambleClojure Conj 2014 - Paradigms of core.async - Julian Gamble
Clojure Conj 2014 - Paradigms of core.async - Julian Gamble
 
DEVNET-1140 InterCloud Mapreduce and Spark Workload Migration and Sharing: Fi...
DEVNET-1140	InterCloud Mapreduce and Spark Workload Migration and Sharing: Fi...DEVNET-1140	InterCloud Mapreduce and Spark Workload Migration and Sharing: Fi...
DEVNET-1140 InterCloud Mapreduce and Spark Workload Migration and Sharing: Fi...
 
jclouds overview
jclouds overviewjclouds overview
jclouds overview
 
jclouds High Level Overview by Adrian Cole
jclouds High Level Overview by Adrian Colejclouds High Level Overview by Adrian Cole
jclouds High Level Overview by Adrian Cole
 
Webinar: What's New in Solr 6
Webinar: What's New in Solr 6Webinar: What's New in Solr 6
Webinar: What's New in Solr 6
 
MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15
MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15
MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15
 
Apache kylin - Big Data Technology Conference 2014 Beijing
Apache kylin - Big Data Technology Conference 2014 BeijingApache kylin - Big Data Technology Conference 2014 Beijing
Apache kylin - Big Data Technology Conference 2014 Beijing
 
MySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 PresentationMySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 Presentation
 
ITSubbotik - как скрестить ежа с ужом или подводные камни внедрения функциона...
ITSubbotik - как скрестить ежа с ужом или подводные камни внедрения функциона...ITSubbotik - как скрестить ежа с ужом или подводные камни внедрения функциона...
ITSubbotik - как скрестить ежа с ужом или подводные камни внедрения функциона...
 
MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)
MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)
MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)
 

More from Knoldus Inc.

More from Knoldus Inc. (20)

Using InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in JmeterUsing InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in Jmeter
 
Intoduction to KubeVela Presentation (DevOps)
Intoduction to KubeVela Presentation (DevOps)Intoduction to KubeVela Presentation (DevOps)
Intoduction to KubeVela Presentation (DevOps)
 
Stakeholder Management (Project Management) Presentation
Stakeholder Management (Project Management) PresentationStakeholder Management (Project Management) Presentation
Stakeholder Management (Project Management) Presentation
 
Introduction To Kaniko (DevOps) Presentation
Introduction To Kaniko (DevOps) PresentationIntroduction To Kaniko (DevOps) Presentation
Introduction To Kaniko (DevOps) Presentation
 
Efficient Test Environments with Infrastructure as Code (IaC)
Efficient Test Environments with Infrastructure as Code (IaC)Efficient Test Environments with Infrastructure as Code (IaC)
Efficient Test Environments with Infrastructure as Code (IaC)
 
Exploring Terramate DevOps (Presentation)
Exploring Terramate DevOps (Presentation)Exploring Terramate DevOps (Presentation)
Exploring Terramate DevOps (Presentation)
 
Clean Code in Test Automation Differentiating Between the Good and the Bad
Clean Code in Test Automation  Differentiating Between the Good and the BadClean Code in Test Automation  Differentiating Between the Good and the Bad
Clean Code in Test Automation Differentiating Between the Good and the Bad
 
Integrating AI Capabilities in Test Automation
Integrating AI Capabilities in Test AutomationIntegrating AI Capabilities in Test Automation
Integrating AI Capabilities in Test Automation
 
State Management with NGXS in Angular.pptx
State Management with NGXS in Angular.pptxState Management with NGXS in Angular.pptx
State Management with NGXS in Angular.pptx
 
Authentication in Svelte using cookies.pptx
Authentication in Svelte using cookies.pptxAuthentication in Svelte using cookies.pptx
Authentication in Svelte using cookies.pptx
 
OAuth2 Implementation Presentation (Java)
OAuth2 Implementation Presentation (Java)OAuth2 Implementation Presentation (Java)
OAuth2 Implementation Presentation (Java)
 
Supply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptxSupply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptx
 
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingMastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
 
Akka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionAkka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On Introduction
 
Entity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxEntity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptx
 
Introduction to Redis and its features.pptx
Introduction to Redis and its features.pptxIntroduction to Redis and its features.pptx
Introduction to Redis and its features.pptx
 
GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdf
 
NuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxNuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptx
 
Data Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingData Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable Testing
 
K8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesK8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose Kubernetes
 

Recently uploaded

Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
mbmh111980
 

Recently uploaded (20)

10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
iGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockiGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by Skilrock
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data Migration
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 

An Introduction to Quill

  • 2. AgendaAgenda 1. What is Quill 2. Why Quill 3. How to use Quill 4. Slick v/s Quill 5. Demo 1. What is Quill 2. Why Quill 3. How to use Quill 4. Slick v/s Quill 5. Demo
  • 3. What is QuillWhat is Quill Quill is a library that provides a Quoted Domain Specific Language (QDSL) for Scala which simplifies working with relational databases. It is an alternative for Slick. The advantage of Quill is support for Compile-Time Language Integrated Queries which allows for database access similar to Scala collections and enables compile-time generated queries. This feature minimizes the runtime overhead of queries. Moreover, it allows query validation during compile-time.
  • 4. Why QuillWhy Quill - Boilerplate-free - Quoted DSL - Compile-time query generation - Compile-time query validation
  • 5. Cont.Cont. select s4.s56, s5.s62, s4.s60, s4.s54 from (select s6.s41 as s51, s6.s42 as s52, s6.s43 as s53, s6.s44 as s54, s6.s45 as s55, s6.s46 as s56, s6.s47 as s57, s7.s48 as s58, s7.s49 as s59, s7.s50 as s60 from (select s8.s34 as s41, s8.s35 as s42, s8.s36 as s43, s8.s37 as s44, s9.s38 as s45, s9.s39 as s46, s9.s40 as s47 from (select s81.`id` as s34, s81.`purchaser_id` as s35, s81.`product_id` as s36, s81.`total` as s37 from `sale` s81) s8 inner join (select s83.`id` as s38, s83.`name` as s39, s83.`address` as s40 from `purchaser` s83) s9 on 1=1) s6 inner join (select s85.`id` as s48, s85.`supplier_id` as s49, s85.`name` as s50 from `product` s85) s7 on 1=1) s4 inner join (select s87.`id` as s61, s87.`name` as s62, s87.`address` as s63 from `supplier` s87) s5 on ((s4.s53 = s4.s58) and (s4.s52 = s4.s55)) and (s4.s59 = s5.s61) where s4.s54 >= ? What’s this?What’s this?
  • 6. That’s actually a join query of 4 tables created by Slick of SELECT purchaser.name, supplier.name, product.name, sale.total FROM sale join purchaser join product join supplier ON (sale.purchaser_id = purchaser.id AND sale.product_id = product.id AND product.supplier_id = supplier.id) WHERE sale.total >= 500 Comparison:- Lifted Embedding: 87.09 s Plain SQL: 0.10 s Cont.Cont.
  • 7. Working with QuillWorking with Quill 1. Build.sbt = libraryDependencies += "io.getquill" %% "quill-async" % "0.8.0" 2. Application.conf = db.default { host = "localhost" port = 3306 user = "root" database = "quill" } 3. Database 4. case classes And you good to go...
  • 8. Cont.Cont. case class User(id: Long, name: String, isActive: Boolean) val Users = quote(query[User].schema(_.generated(_.id))) or query[Users].schema(_.entity("user_table").columns(_.id -> "id_column", _.namr → “name_col”)) lazy val ctx = new MysqlAsyncContext[SnakeCase]("db.default") Or you can use built in Dialects lazy val ctx = new JdbcContext[MySQLDialect, SnakeCase]("db.default")
  • 9. Cont.Cont. Naming strategy io.getquill.naming.Literal = some_ident -> some_ident io.getquill.naming.Escape = some_ident -> “some_ident” io.getquill.naming.UpperCase = some_ident -> SOME_IDENT io.getquill.naming.LowerCase = SOME_IDENT -> some_ident io.getquill.naming.SnakeCase = someIdent -> some_ident io.getquill.naming.CamelCase = some_ident -> someIdent io.getquill.naming.MysqlEscape = some_ident -> `some_ident` io.getquill.naming.PostgresEscape= $some_ident -> $some_ident
  • 10. Cont.Cont. Operations:- 1. Filter 2. Map 3. FlatMap 4. SortBy 5. Drop/take 6. GroupBy 7. Union 8. Joins And many more...
  • 11. Cont.Cont. Insert: val insQuery = quote(query[Contact].insert) ctx.run(insQuery)(List(Contact(999, "987654321"))) // INSERT INTO Person (id,age) VALUES (?, ?) Update: val upQuery = quote {query[Person].filter(_.id == 999).update} ctx.run(upQuery)(List(Person(999, "John", 22))) // UPDATE Person SET id = ?, name = ?, age = ? WHERE id = 999 Delete: val delQuery = quote {query[Person].filter(p => p.name == "").delete} ctx.run(delQuery) // DELETE FROM Person WHERE name = ''
  • 12. Cont.Cont. - Supports transactions - Not supported features can be implemented by INFIX - Supports H2, MySql, Postgres, cassandra.
  • 13. Slick v/s Quill SLICK Quill Popularity 9.2 7.7 Activity 6.7 9.2 Repository Stars 1602 Watchers 156 Forks 376 Last Commit 9 days ago Stars 631 Watchers 40 Forks 75 Last Commit 3 days ago
  • 15. Questions & Ans.fold(“you’ll get it tomorrow”)(identity)

Editor's Notes

  1. - Boilerplate-free mapping Quoted DSL: Queries are defined inside a quote block. Quill parses each quoted block of code (quotation) at compile time and translates them to an internal Abstract Syntax Tree (AST) Compile-time query generation: The ctx.run call reads the quotation’s AST and translates it to the target language at compile time, emitting the query string as a compilation message. As the query string is known at compile time, the runtime overhead is very low and similar to using the database driver directly. Compile-time query validation: If configured, the query is verified against the database at compile time and the compilation fails if it is not valid. The query validation does not alter the database state.
  2. - Boilerplate-free mapping Quoted DSL: Queries are defined inside a quote block. Quill parses each quoted block of code (quotation) at compile time and translates them to an internal Abstract Syntax Tree (AST) Compile-time query generation: The ctx.run call reads the quotation’s AST and translates it to the target language at compile time, emitting the query string as a compilation message. As the query string is known at compile time, the runtime overhead is very low and similar to using the database driver directly. Compile-time query validation: If configured, the query is verified against the database at compile time and the compilation fails if it is not valid. The query validation does not alter the database state.
  3. - Boilerplate-free mapping Quoted DSL: Queries are defined inside a quote block. Quill parses each quoted block of code (quotation) at compile time and translates them to an internal Abstract Syntax Tree (AST) Compile-time query generation: The ctx.run call reads the quotation’s AST and translates it to the target language at compile time, emitting the query string as a compilation message. As the query string is known at compile time, the runtime overhead is very low and similar to using the database driver directly. Compile-time query validation: If configured, the query is verified against the database at compile time and the compilation fails if it is not valid. The query validation does not alter the database state.
  4. The SQL dialect to be used by the context is defined by the first type parameter. Some context types are specific to a database and thus not require it. Quill has four built-in dialects: io.getquill.H2Dialect io.getquill.MySQLDialect io.getquill.PostgresDialect io.getquill.SqliteDialect
  5. The SQL dialect to be used by the context is defined by the first type parameter. Some context types are specific to a database and thus not require it. Quill has four built-in dialects: io.getquill.H2Dialect io.getquill.MySQLDialect io.getquill.PostgresDialect io.getquill.SqliteDialect
  6. The SQL dialect to be used by the context is defined by the first type parameter. Some context types are specific to a database and thus not require it. Quill has four built-in dialects: io.getquill.H2Dialect io.getquill.MySQLDialect io.getquill.PostgresDialect io.getquill.SqliteDialect
  7. The SQL dialect to be used by the context is defined by the first type parameter. Some context types are specific to a database and thus not require it. Quill has four built-in dialects: io.getquill.H2Dialect io.getquill.MySQLDialect io.getquill.PostgresDialect io.getquill.SqliteDialect
  8. The SQL dialect to be used by the context is defined by the first type parameter. Some context types are specific to a database and thus not require it. Quill has four built-in dialects: io.getquill.H2Dialect io.getquill.MySQLDialect io.getquill.PostgresDialect io.getquill.SqliteDialect
  9. Piyush Mishra
  10. Piyush Mishra