SlideShare uma empresa Scribd logo
1 de 18
Database abstraction – GoogleApps Script
Desktop liberation
A massively scalable cloud based datastore
Usually used along with Google App Engine
APIs available for Python, Go, Java, Php
A JSONAPI exists
Has an SQL like query language (GQL)
GQL is query only
Only really supports flat level objects
Free daily quota can be eaten up fairly quickly
Many capabilities, fairly complex
It’s a database Jim, but not as we know it
There is no API for Google Apps Script
Have to use the JSON API, which is complex
and limited
Complex queries need pre-specified indexes
It’s conceptually different to normal
databases and structures
Oauth2 is mandatory
Database abstraction aims to simplify all that
With dbAbstraction, DataStore noSQL queries are the
same for all supported backends. So far this includes
Scriptdb
Parse.com
Fusion
Orchestrate.io
Fusion
Sheets
Import.io
Drive
Properties
DataStore
Your Script
cDataHandler
library
cEzyOauth2
library
cCacheHandler
library
Your webapp
App template
Your property
store
cDataStore
driver
Cloud
DataStore
cFlattener
library
noSQL queries
Access token
Google oauth2
infrastructure
Query caching
cNamedLock
library
Transaction locking
JSON API
Query translation
authentication
Cloud
credentials
Access & refresh tokens
(un)Flatten objects
The same as other database backends up to
the driver
Caching, locking and oAuth2 built in
Complex objects supported through
flattening with dot syntax
Complex queries handled by DataStore when
index exists
Non indexed queries automatically handled
by driver filtering
handler.query ( );
handler.query ({sex:”male”} );
handler.query ({sex:”male”,country:”USA”} );
handler.query ({sex:”male”,network:{google:{usage:”seldom”}}});
Handler.query({sex:”male”,”network.google.usage”:”seldom”});
Handler.query({sex:”female”,handler.constraint([[c.GT,50],[c.LT,6
0]])});
Handler.query({},{limit:20,sort:”-age”});
Handler.query({sex:”female”,
age:handler.constraint([[c.GT,50],[c.LT,60]] ,
name:handler.constraint([[c.IN,[”smith”,”jones”]] )},
{sort:”network.google.usage”});
handler.count ({sex:”male”} );
handler.remove ( );
handler.remove ({sex:”male”} );
handler.remove({query ({sex:”male”,country:”USA”} );
handler.remove({sex:”male”,network:{google:{usage:”seldo
m”}}});
Handler.remove({sex:”male”,”network.google.usage”:”seld
om”});
Handler.remove({sex:”female”,handler.constraint([[c.GT,50]
,[c.LT,60]])});
Handler.remove({},{limit:20,sort:”-age”});
handler.save({name:”john”,age:25,country:”USA”,network:{
google:”seldom”,facebook:”often”}} );
handler.save([{name:”john”,age:25,country:”USA”,network:
{google:”seldom”,facebook:”often”}},
name:”mary”,age:28,country:”UK”,network:{google:”ofte
n”,facebook:”never”}}]);
var result = handler.query
({network.google:”seldom”},undefined,1, true );
result.data.forEach(function(d) { d.target = true; });
handler.update (result.handleKeys, result.data);
var result = handler.query
({network.google:”often”},{sort:”age”,limit:10},1, true);
result.data.forEach(function(d) { d.target = true; });
handler.update (result.handleKeys, result.data);
var resultFromCache = handler.query
({network.google:”seldom”});
var resultNoCache = handler.query
({network.google:”seldom”,undefined, 1});
A standard recipe
function doGet (e) {
return doGetPattern(e, constructConsentScreen, doSomething, 'googleDatastore') ;
}
1. The name of a function that returns an html string with a user consent dialog. Will only get
called the first time doGet() is run to kick off the self maintaining access/refresh token
details
2. The name of a function that does what your doGet() would normally do, and returns what it
would normally return
3. A unique name against which to store the access/refresh token details in the property store
1 2 3
Your datastore credentials and scopes should be
stored in your properties store
EzyOauth2 will update your credentials object
with refresh and access token information
Every time after the first time run, your access
token will be refreshed automatically when
necessary
Functions are provided in the pattern for your
function to read and write properties, but the
libraries never access your properties directly.
The ongoing pattern is more or less the same
for both webapp and non-webapp
doGet() needs to be run at least once to
provoke an authorization dialog
Non- webapps need a doGet() function run
just once to get the refresh token
infrastructure set up.You can delete the
doGet() function after that.
Code is in the Patterns example, and looks like
this. Substitute your own credentials and run
function oneTimeSetProperties () {
setAuthenticationPackage_ ({
clientId : “xxx.apps.googleusercontent.com",
clientSecret : “xxx",
scopes :
['https://www.googleapis.com/auth/datastore','https://www.googleapis.com/a
uth/userinfo.email'],
service: 'google',
packageName: 'googleDatastore'
});
}
Substitute your credentials and run this , one time
function oneTimeSetProperties () {
setAuthenticationPackage_ ({
clientId : “xxx.apps.googleusercontent.com",
clientSecret : “xxx",
scopes : ['https://www.googleapis.com/auth/datastore','https://www.googleapis.com/auth
service: 'google',
packageName: 'googleDatastore'
});
}
This will get created
library key comments
cDataHandler Mj61W-
201_t_zC9fJg1IzYiz3TLx7pV4j
Abstracted interface to back end databases, and all
known drivers
cCacheHandler MXhfe1Z1GKU-_Qnd94LqcsKi_d-
phDA33
Manages caching of query results
cNamedLock MBaYiatjgCSvDcsG6fHIFsyz3TLx7p
V4j
Cross script locking of abstract resources
cEzyOauth2 MSaYlTXSVk7FAqpHNCcqBv6i_d-
phDA33
Manages oAuth2 credentials and offline refreshing of
access tokens
cFlatten MqxKdBrlw18FDd-
X5zQLd7yz3TLx7pV4j
Flattens complex objects to 1 level dot syntax objects so
they can be stored/queries in a 2 dimensional space
ezyOauth2 templates https://script.google.com/d/1ll5nvM
OZL5YODaj71l0-
XSaD0BBciG_zIV2I0Neu3Nz1LaKY6
-4WiJAt/edit?usp=sharing
Patterns for web and nonweb apps for easy oath2
authentication.Take a copy of this
Read about data abstraction using the
datastore here.
Read about ezyOauth2 here.
Contact me on google plus or at my forum
Join the Google Apps Script Community

Mais conteúdo relacionado

Mais procurados

Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheetDo something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheetBruce McPherson
 
Do something in 5 with gas 9-copy between databases with oauth2
Do something in 5 with gas 9-copy between databases with oauth2Do something in 5 with gas 9-copy between databases with oauth2
Do something in 5 with gas 9-copy between databases with oauth2Bruce McPherson
 
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your DataMongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your DataMongoDB
 
Do something in 5 with gas 8-copy between databases
Do something in 5 with gas 8-copy between databasesDo something in 5 with gas 8-copy between databases
Do something in 5 with gas 8-copy between databasesBruce McPherson
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineJason Terpko
 
Euruko 2009 - DataObjects
Euruko 2009 - DataObjectsEuruko 2009 - DataObjects
Euruko 2009 - DataObjectsDirkjan Bussink
 
Elasticsearch an overview
Elasticsearch   an overviewElasticsearch   an overview
Elasticsearch an overviewAmit Juneja
 
FleetDB: A Schema-Free Database in Clojure
FleetDB: A Schema-Free Database in ClojureFleetDB: A Schema-Free Database in Clojure
FleetDB: A Schema-Free Database in ClojureMark McGranaghan
 
Py spark cheat sheet by cheatsheetmaker.com
Py spark cheat sheet by cheatsheetmaker.comPy spark cheat sheet by cheatsheetmaker.com
Py spark cheat sheet by cheatsheetmaker.comLam Hoang
 
Building data flows with Celery and SQLAlchemy
Building data flows with Celery and SQLAlchemyBuilding data flows with Celery and SQLAlchemy
Building data flows with Celery and SQLAlchemyRoger Barnes
 
Sprout core and performance
Sprout core and performanceSprout core and performance
Sprout core and performanceYehuda Katz
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersAmanda Gilmore
 
Appengine Java Night #2b
Appengine Java Night #2bAppengine Java Night #2b
Appengine Java Night #2bShinichi Ogawa
 
Softshake - Offline applications
Softshake - Offline applicationsSoftshake - Offline applications
Softshake - Offline applicationsjeromevdl
 

Mais procurados (20)

Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheetDo something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
 
Html indexed db
Html indexed dbHtml indexed db
Html indexed db
 
Do something in 5 with gas 9-copy between databases with oauth2
Do something in 5 with gas 9-copy between databases with oauth2Do something in 5 with gas 9-copy between databases with oauth2
Do something in 5 with gas 9-copy between databases with oauth2
 
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your DataMongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
 
Do something in 5 with gas 8-copy between databases
Do something in 5 with gas 8-copy between databasesDo something in 5 with gas 8-copy between databases
Do something in 5 with gas 8-copy between databases
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation Pipeline
 
Euruko 2009 - DataObjects
Euruko 2009 - DataObjectsEuruko 2009 - DataObjects
Euruko 2009 - DataObjects
 
Elasticsearch an overview
Elasticsearch   an overviewElasticsearch   an overview
Elasticsearch an overview
 
FleetDB: A Schema-Free Database in Clojure
FleetDB: A Schema-Free Database in ClojureFleetDB: A Schema-Free Database in Clojure
FleetDB: A Schema-Free Database in Clojure
 
Py spark cheat sheet by cheatsheetmaker.com
Py spark cheat sheet by cheatsheetmaker.comPy spark cheat sheet by cheatsheetmaker.com
Py spark cheat sheet by cheatsheetmaker.com
 
Building data flows with Celery and SQLAlchemy
Building data flows with Celery and SQLAlchemyBuilding data flows with Celery and SQLAlchemy
Building data flows with Celery and SQLAlchemy
 
Polyglot parallelism
Polyglot parallelismPolyglot parallelism
Polyglot parallelism
 
Html web sql database
Html web sql databaseHtml web sql database
Html web sql database
 
#ajn3.lt.marblejenka
#ajn3.lt.marblejenka#ajn3.lt.marblejenka
#ajn3.lt.marblejenka
 
Database c# connetion
Database c# connetionDatabase c# connetion
Database c# connetion
 
Sprout core and performance
Sprout core and performanceSprout core and performance
Sprout core and performance
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL Superpowers
 
Appengine Java Night #2b
Appengine Java Night #2bAppengine Java Night #2b
Appengine Java Night #2b
 
Softshake - Offline applications
Softshake - Offline applicationsSoftshake - Offline applications
Softshake - Offline applications
 
greenDAO
greenDAOgreenDAO
greenDAO
 

Destaque

Destaque (16)

Cloud sql datasheet
Cloud sql datasheetCloud sql datasheet
Cloud sql datasheet
 
Intellectual Intersections, draft program
Intellectual Intersections, draft programIntellectual Intersections, draft program
Intellectual Intersections, draft program
 
My Sql Performance In A Cloud
My Sql Performance In A CloudMy Sql Performance In A Cloud
My Sql Performance In A Cloud
 
Getting Started with Google Cloud Technology
Getting Started with Google Cloud TechnologyGetting Started with Google Cloud Technology
Getting Started with Google Cloud Technology
 
2011 july-gtug-high-replication-datastore
2011 july-gtug-high-replication-datastore2011 july-gtug-high-replication-datastore
2011 july-gtug-high-replication-datastore
 
Webapp2 2.2
Webapp2 2.2Webapp2 2.2
Webapp2 2.2
 
Data Migrations in the App Engine Datastore
Data Migrations in the App Engine DatastoreData Migrations in the App Engine Datastore
Data Migrations in the App Engine Datastore
 
AWS Webcast - Highly Available SQL Server on AWS
AWS Webcast - Highly Available SQL Server on AWS  AWS Webcast - Highly Available SQL Server on AWS
AWS Webcast - Highly Available SQL Server on AWS
 
Restful App Engine
Restful App EngineRestful App Engine
Restful App Engine
 
Scaling Galaxy on Google Cloud Platform
Scaling Galaxy on Google Cloud PlatformScaling Galaxy on Google Cloud Platform
Scaling Galaxy on Google Cloud Platform
 
SQL Server on Google Cloud Platform
SQL Server on Google Cloud PlatformSQL Server on Google Cloud Platform
SQL Server on Google Cloud Platform
 
google Bigtable
google Bigtablegoogle Bigtable
google Bigtable
 
工程師必備第一工具 - Git
工程師必備第一工具 - Git工程師必備第一工具 - Git
工程師必備第一工具 - Git
 
Google BigTable
Google BigTableGoogle BigTable
Google BigTable
 
Cloud computing simple ppt
Cloud computing simple pptCloud computing simple ppt
Cloud computing simple ppt
 
The Google Bigtable
The Google BigtableThe Google Bigtable
The Google Bigtable
 

Semelhante a Google cloud datastore driver for Google Apps Script DB abstraction

Google App Engine With Java And Groovy
Google App Engine With Java And GroovyGoogle App Engine With Java And Groovy
Google App Engine With Java And GroovyKen Kousen
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for JavaLars Vogel
 
Zepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-FrameworksZepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-FrameworksThomas Fuchs
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Enginecatherinewall
 
Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Tony Frame
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with PythonBrian Lyttle
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaDavid Chandler
 
Nuxeo - OpenSocial
Nuxeo - OpenSocialNuxeo - OpenSocial
Nuxeo - OpenSocialThomas Roger
 
Academy PRO: HTML5 Data storage
Academy PRO: HTML5 Data storageAcademy PRO: HTML5 Data storage
Academy PRO: HTML5 Data storageBinary Studio
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang YoonJesang Yoon
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for JavaLars Vogel
 
Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011Opevel
 
Hibernate jj
Hibernate jjHibernate jj
Hibernate jjJoe Jacob
 
Flask jwt authentication tutorial
Flask jwt authentication tutorialFlask jwt authentication tutorial
Flask jwt authentication tutorialKaty Slemon
 
Android application architecture
Android application architectureAndroid application architecture
Android application architectureRomain Rochegude
 
What is App Engine? O
What is App Engine? OWhat is App Engine? O
What is App Engine? Oikailan
 

Semelhante a Google cloud datastore driver for Google Apps Script DB abstraction (20)

Google App Engine With Java And Groovy
Google App Engine With Java And GroovyGoogle App Engine With Java And Groovy
Google App Engine With Java And Groovy
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
Zepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-FrameworksZepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-Frameworks
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
 
Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for Java
 
Meteor Angular
Meteor AngularMeteor Angular
Meteor Angular
 
Nuxeo - OpenSocial
Nuxeo - OpenSocialNuxeo - OpenSocial
Nuxeo - OpenSocial
 
Academy PRO: HTML5 Data storage
Academy PRO: HTML5 Data storageAcademy PRO: HTML5 Data storage
Academy PRO: HTML5 Data storage
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoon
 
Tomcat + other things
Tomcat + other thingsTomcat + other things
Tomcat + other things
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011
 
Hibernate jj
Hibernate jjHibernate jj
Hibernate jj
 
Flask jwt authentication tutorial
Flask jwt authentication tutorialFlask jwt authentication tutorial
Flask jwt authentication tutorial
 
Android application architecture
Android application architectureAndroid application architecture
Android application architecture
 
What is App Engine? O
What is App Engine? OWhat is App Engine? O
What is App Engine? O
 

Mais de Bruce McPherson

Do something in 5 with apps scripts number 6 - fusion crossfilter
Do something in 5 with apps scripts number 6 - fusion crossfilterDo something in 5 with apps scripts number 6 - fusion crossfilter
Do something in 5 with apps scripts number 6 - fusion crossfilterBruce McPherson
 
Do something in 5 with gas 7-email log
Do something in 5 with gas 7-email logDo something in 5 with gas 7-email log
Do something in 5 with gas 7-email logBruce McPherson
 
Do something in 5 with gas 3-simple invoicing app
Do something in 5 with gas 3-simple invoicing appDo something in 5 with gas 3-simple invoicing app
Do something in 5 with gas 3-simple invoicing appBruce McPherson
 
Do something in 5 with gas 2-graduate to a database
Do something in 5 with gas 2-graduate to a databaseDo something in 5 with gas 2-graduate to a database
Do something in 5 with gas 2-graduate to a databaseBruce McPherson
 
Do something in 5 minutes with gas 1-use spreadsheet as database
Do something in 5 minutes with gas 1-use spreadsheet as databaseDo something in 5 minutes with gas 1-use spreadsheet as database
Do something in 5 minutes with gas 1-use spreadsheet as databaseBruce McPherson
 
Javascript like objects and JSON processing in VBA
Javascript like objects and JSON processing in VBAJavascript like objects and JSON processing in VBA
Javascript like objects and JSON processing in VBABruce McPherson
 

Mais de Bruce McPherson (6)

Do something in 5 with apps scripts number 6 - fusion crossfilter
Do something in 5 with apps scripts number 6 - fusion crossfilterDo something in 5 with apps scripts number 6 - fusion crossfilter
Do something in 5 with apps scripts number 6 - fusion crossfilter
 
Do something in 5 with gas 7-email log
Do something in 5 with gas 7-email logDo something in 5 with gas 7-email log
Do something in 5 with gas 7-email log
 
Do something in 5 with gas 3-simple invoicing app
Do something in 5 with gas 3-simple invoicing appDo something in 5 with gas 3-simple invoicing app
Do something in 5 with gas 3-simple invoicing app
 
Do something in 5 with gas 2-graduate to a database
Do something in 5 with gas 2-graduate to a databaseDo something in 5 with gas 2-graduate to a database
Do something in 5 with gas 2-graduate to a database
 
Do something in 5 minutes with gas 1-use spreadsheet as database
Do something in 5 minutes with gas 1-use spreadsheet as databaseDo something in 5 minutes with gas 1-use spreadsheet as database
Do something in 5 minutes with gas 1-use spreadsheet as database
 
Javascript like objects and JSON processing in VBA
Javascript like objects and JSON processing in VBAJavascript like objects and JSON processing in VBA
Javascript like objects and JSON processing in VBA
 

Último

+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...Health
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabiaahmedjiabur940
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样wsppdmt
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...Bertram Ludäscher
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangeThinkInnovation
 
Harnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptxHarnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptxParas Gupta
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareGraham Ware
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRajesh Mondal
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制vexqp
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...Elaine Werffeli
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...gajnagarg
 
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptxThe-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptxVivek487417
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteedamy56318795
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...nirzagarg
 
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制vexqp
 
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling ManjurJual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjurptikerjasaptiker
 

Último (20)

+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit RiyadhCytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
 
Harnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptxHarnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptx
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for Research
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
 
Sequential and reinforcement learning for demand side management by Margaux B...
Sequential and reinforcement learning for demand side management by Margaux B...Sequential and reinforcement learning for demand side management by Margaux B...
Sequential and reinforcement learning for demand side management by Margaux B...
 
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptxThe-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
 
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
 
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling ManjurJual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
 

Google cloud datastore driver for Google Apps Script DB abstraction

  • 1. Database abstraction – GoogleApps Script Desktop liberation
  • 2. A massively scalable cloud based datastore Usually used along with Google App Engine APIs available for Python, Go, Java, Php A JSONAPI exists Has an SQL like query language (GQL) GQL is query only Only really supports flat level objects Free daily quota can be eaten up fairly quickly Many capabilities, fairly complex It’s a database Jim, but not as we know it
  • 3. There is no API for Google Apps Script Have to use the JSON API, which is complex and limited Complex queries need pre-specified indexes It’s conceptually different to normal databases and structures Oauth2 is mandatory Database abstraction aims to simplify all that
  • 4. With dbAbstraction, DataStore noSQL queries are the same for all supported backends. So far this includes Scriptdb Parse.com Fusion Orchestrate.io Fusion Sheets Import.io Drive Properties DataStore
  • 5. Your Script cDataHandler library cEzyOauth2 library cCacheHandler library Your webapp App template Your property store cDataStore driver Cloud DataStore cFlattener library noSQL queries Access token Google oauth2 infrastructure Query caching cNamedLock library Transaction locking JSON API Query translation authentication Cloud credentials Access & refresh tokens (un)Flatten objects
  • 6. The same as other database backends up to the driver Caching, locking and oAuth2 built in Complex objects supported through flattening with dot syntax Complex queries handled by DataStore when index exists Non indexed queries automatically handled by driver filtering
  • 7. handler.query ( ); handler.query ({sex:”male”} ); handler.query ({sex:”male”,country:”USA”} ); handler.query ({sex:”male”,network:{google:{usage:”seldom”}}}); Handler.query({sex:”male”,”network.google.usage”:”seldom”}); Handler.query({sex:”female”,handler.constraint([[c.GT,50],[c.LT,6 0]])}); Handler.query({},{limit:20,sort:”-age”}); Handler.query({sex:”female”, age:handler.constraint([[c.GT,50],[c.LT,60]] , name:handler.constraint([[c.IN,[”smith”,”jones”]] )}, {sort:”network.google.usage”}); handler.count ({sex:”male”} );
  • 8. handler.remove ( ); handler.remove ({sex:”male”} ); handler.remove({query ({sex:”male”,country:”USA”} ); handler.remove({sex:”male”,network:{google:{usage:”seldo m”}}}); Handler.remove({sex:”male”,”network.google.usage”:”seld om”}); Handler.remove({sex:”female”,handler.constraint([[c.GT,50] ,[c.LT,60]])}); Handler.remove({},{limit:20,sort:”-age”});
  • 10. var result = handler.query ({network.google:”seldom”},undefined,1, true ); result.data.forEach(function(d) { d.target = true; }); handler.update (result.handleKeys, result.data); var result = handler.query ({network.google:”often”},{sort:”age”,limit:10},1, true); result.data.forEach(function(d) { d.target = true; }); handler.update (result.handleKeys, result.data);
  • 11. var resultFromCache = handler.query ({network.google:”seldom”}); var resultNoCache = handler.query ({network.google:”seldom”,undefined, 1});
  • 12. A standard recipe function doGet (e) { return doGetPattern(e, constructConsentScreen, doSomething, 'googleDatastore') ; } 1. The name of a function that returns an html string with a user consent dialog. Will only get called the first time doGet() is run to kick off the self maintaining access/refresh token details 2. The name of a function that does what your doGet() would normally do, and returns what it would normally return 3. A unique name against which to store the access/refresh token details in the property store 1 2 3
  • 13. Your datastore credentials and scopes should be stored in your properties store EzyOauth2 will update your credentials object with refresh and access token information Every time after the first time run, your access token will be refreshed automatically when necessary Functions are provided in the pattern for your function to read and write properties, but the libraries never access your properties directly.
  • 14. The ongoing pattern is more or less the same for both webapp and non-webapp doGet() needs to be run at least once to provoke an authorization dialog Non- webapps need a doGet() function run just once to get the refresh token infrastructure set up.You can delete the doGet() function after that.
  • 15. Code is in the Patterns example, and looks like this. Substitute your own credentials and run function oneTimeSetProperties () { setAuthenticationPackage_ ({ clientId : “xxx.apps.googleusercontent.com", clientSecret : “xxx", scopes : ['https://www.googleapis.com/auth/datastore','https://www.googleapis.com/a uth/userinfo.email'], service: 'google', packageName: 'googleDatastore' }); }
  • 16. Substitute your credentials and run this , one time function oneTimeSetProperties () { setAuthenticationPackage_ ({ clientId : “xxx.apps.googleusercontent.com", clientSecret : “xxx", scopes : ['https://www.googleapis.com/auth/datastore','https://www.googleapis.com/auth service: 'google', packageName: 'googleDatastore' }); } This will get created
  • 17. library key comments cDataHandler Mj61W- 201_t_zC9fJg1IzYiz3TLx7pV4j Abstracted interface to back end databases, and all known drivers cCacheHandler MXhfe1Z1GKU-_Qnd94LqcsKi_d- phDA33 Manages caching of query results cNamedLock MBaYiatjgCSvDcsG6fHIFsyz3TLx7p V4j Cross script locking of abstract resources cEzyOauth2 MSaYlTXSVk7FAqpHNCcqBv6i_d- phDA33 Manages oAuth2 credentials and offline refreshing of access tokens cFlatten MqxKdBrlw18FDd- X5zQLd7yz3TLx7pV4j Flattens complex objects to 1 level dot syntax objects so they can be stored/queries in a 2 dimensional space ezyOauth2 templates https://script.google.com/d/1ll5nvM OZL5YODaj71l0- XSaD0BBciG_zIV2I0Neu3Nz1LaKY6 -4WiJAt/edit?usp=sharing Patterns for web and nonweb apps for easy oath2 authentication.Take a copy of this
  • 18. Read about data abstraction using the datastore here. Read about ezyOauth2 here. Contact me on google plus or at my forum Join the Google Apps Script Community