SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

En vedette (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
 

Similaire à 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
 

Similaire à 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
 

Plus 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
 

Plus 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
 

Dernier

Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Jack DiGiovanna
 
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...Boston Institute of Analytics
 
DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfJohn Sterrett
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectBoston Institute of Analytics
 
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...ssuserf63bd7
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFAAndrei Kaleshka
 
Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Seán Kennedy
 
While-For-loop in python used in college
While-For-loop in python used in collegeWhile-For-loop in python used in college
While-For-loop in python used in collegessuser7a7cd61
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一F sss
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
 
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfBoston Institute of Analytics
 
Learn How Data Science Changes Our World
Learn How Data Science Changes Our WorldLearn How Data Science Changes Our World
Learn How Data Science Changes Our WorldEduminds Learning
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...Florian Roscheck
 
Machine learning classification ppt.ppt
Machine learning classification  ppt.pptMachine learning classification  ppt.ppt
Machine learning classification ppt.pptamreenkhanum0307
 
Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryJeremy Anderson
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一fhwihughh
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...limedy534
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...GQ Research
 
Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Seán Kennedy
 

Dernier (20)

Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
 
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
 
DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdf
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis Project
 
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFA
 
Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...
 
While-For-loop in python used in college
While-For-loop in python used in collegeWhile-For-loop in python used in college
While-For-loop in python used in college
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
 
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
 
Learn How Data Science Changes Our World
Learn How Data Science Changes Our WorldLearn How Data Science Changes Our World
Learn How Data Science Changes Our World
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
 
Machine learning classification ppt.ppt
Machine learning classification  ppt.pptMachine learning classification  ppt.ppt
Machine learning classification ppt.ppt
 
Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data Story
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
 
Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...
 

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