sandro fiore ([email protected]) alessandro negro ([email protected])

23
Sandro Fiore ([email protected]) Alessandro Negro ([email protected]) SPACI Consortium & University of Salento, Lecce The Grid Relational Catalog Project Tutorial

Upload: laasya

Post on 15-Jan-2016

31 views

Category:

Documents


0 download

DESCRIPTION

The Grid Relational Catalog Project Tutorial. Sandro Fiore ([email protected]) Alessandro Negro ([email protected]) SPACI Consortium & University of Salento, Lecce. What we will see during the tutorial. Authorization Select Queries grelc-das-query-memory grelc-das-query-dime - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

Sandro Fiore ([email protected])Alessandro Negro ([email protected])

SPACI Consortium & University of Salento, Lecce

The Grid Relational Catalog ProjectTutorial

Page 2: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

2GRelC Project - http://grelc.unile.it

What we will see during the tutorial

• Authorization

• Select Queries

‣ grelc-das-query-memory

‣ grelc-das-query-dime

‣ grelc-das-query-stream

• GRelC Portal

• https://grid.ct.infn.it/twiki/bin/view/GILDA/GRelCDataAccessService

• https://grid.ct.infn.it/twiki/bin/view/GILDA/GRelCPortal

• https://grid.ct.infn.it/twiki/bin/view/GILDA/GRelCPortalAdvanced

Page 3: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

3GRelC Project - http://grelc.unile.it

Authorization framework

• Before starting be sure you have a valid proxy …

• To create a valid proxy, run the following command

‣ grid-proxy-init

• With this proxy you will be able to access the sakila database on grelc02.unile.it (only select statements)

Page 4: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

4GRelC Project - http://grelc.unile.it

Select Queries

• To carry out SELECT queries you can use the following commands

‣ grelc-das-query-memory

‣ grelc-das-query-dime

‣ grelc-das-query-stream

• These kinds of query were designed to address high performance

Page 5: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

5GRelC Project - http://grelc.unile.it

Single Query Memory

1. Display help

> grelc-das-query-memory -h

USAGE: query-das-memory [options]

-s, --server VAL Sets GRelC DAS IP or hostname (default: localhost)

-p, --port NUM Sets GRelC DAS port (default: 18500)

-D, --database VAL Sets grid database name

-Q, --query VAL Sets query value

-c, --chunk NUM Sets chunk dimension (default:0 no chunk)

-t, --table Prints result in table format (default)

-x, --xml Prints result in xml format

-H, --html Prints result in html format

-h, --help Shows usage

EXAMPLES:

query submission without chunking

grelc-das-query-memory -s hostname -p 18500 -D database -Q 'select * from table'

query submission with chunking

grelc-das-query-memory -s hostname -p 18500 -D database -Q 'select * from table' -c 50

Page 6: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

6GRelC Project - http://grelc.unile.it

Single Query Memory

2. Submits a query and displays its result in tabular format. The result is transferred one-shot.

> grelc-das-query-memory -s grelc02.unile.it -p 18500 -D sakila -Q "select * from actor" -t

3. Submits a query and displays its result in XML format. The result is transferred one-shot.

> grelc-das-query-memory -s grelc02.unile.it -p 18500 -D sakila -Q "select * from actor" -x

4. Submits a query and displays its result in XML format. The result is transferred in chunks of 50 tuples. The result shown is exactly the same of example no. 3

> grelc-das-query-memory -s grelc02.unile.it -p 18500 -D sakila -Q "select * from actor" -x -c 50

Page 7: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

7GRelC Project - http://grelc.unile.it

Single Query File

5. Display help

> grelc-das-query-dime -h

USAGE: query-das-dime [options]

-s, --server VAL Sets GRelC DAS IP or hostname (default: localhost)

-p, --port NUM Sets GRelC DAS port (default: 18500)

-D, --database VAL Sets grid database name

-Q, --query VAL Sets query value

-c, --chunk NUM Sets chunk dimension (default:0 no chunk)

-z, --gzip Compresses result file

-t, --table Prints result in table format (default)

-x, --xml Prints result in xml format

-h, --help Shows usage

EXAMPLES:

query submission with compression

grelc-das-query-dime -s hostname -p 18500 -D database -Q 'select * from table' -z

query submission with chunking

grelc-das-query-dime -s hostname -p 18500 -D database -Q 'select * from table' -c 50

Page 8: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

8GRelC Project - http://grelc.unile.it

Single Query File

6. Submits a query and displays its result in tabular format. The result is transferred one-shot.

> grelc-das-query-dime -s grelc02.unile.it -p 18500 -D sakila -t -Q "select * from actor"

7. Submits a query and displays its result in XML format. The result is transferred one-shot.

> grelc-das-query-dime -s grelc02.unile.it -p 18500 -D sakila -x -Q "select * from actor"

8. Submits a query and displays its result in XML format. The result is transferred in chunks of 50 tuples.

> grelc-das-query-dime -s grelc02.unile.it -p 18500 -D sakila -x -Q "select * from actor" -c 50

9. Now, let's look at the files in your current folder. Each file is a resultset stored client-side.

> ls -lrta

Page 9: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

9GRelC Project - http://grelc.unile.it

Single Query File

10. Let's see what's inside one of the resultsets stored client-side.

> more .grelc02.unile.it_18500_171-singlequery.xml

11. Submits a query and displays its result in XML format. The result is compressed (using -z option) and transferred in chunks of 50 tuples.

> grelc-das-query-dime -s grelc02.unile.it -p 18500 -D sakila -x -Q "select * from actor" -z

12. Now, let's look at the files in your current folder again. You can find a compressed and an uncompressed file for each resultset stored client-side.

> ls -lrta

Page 10: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

10

GRelC Project - http://grelc.unile.it

Single Query Stream

13. Submits a query and displays its result in tabular format. The result is transferred by using data streaming.

> grelc-das-query-stream -s grelc02.unile.it -p 18500 -D sakila -t -Q "select * from actor"

14. Submits a query and displays its result in XML format. The result is transferred one-shot.

grelc-das-query-stream -s grelc02.unile.it -p 18500 -D sakila -x -Q "select * from actor”

Page 11: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

11

GRelC Project - http://grelc.unile.it

GRelC Portal Authorization

• Before starting be sure you have a valid proxy with the correct GRelC DAS Role

• To create a valid proxy, run one of the following commands

• grid-proxy-init

• With this proxy you will be able to access the sakila database on grelc02.unile.it…

Page 12: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

12

GRelC Project - http://grelc.unile.it

Select your proxy

Page 13: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

13

GRelC Project - http://grelc.unile.it

Adding one entry to the GRelC DAS List

Page 14: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

14

GRelC Project - http://grelc.unile.it

Grid Databases Management

Page 15: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

15

GRelC Project - http://grelc.unile.it

Tables Management

Page 16: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

16

GRelC Project - http://grelc.unile.it

View Schema

Page 17: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

17

GRelC Project - http://grelc.unile.it

View Data

Page 18: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

18

GRelC Project - http://grelc.unile.it

Query Submission

Page 19: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

19

GRelC Project - http://grelc.unile.it

Query Submission

• Let’s start with a simple select query...

select * from film

• This query retrieves all of the films available in the “sakila” database

Page 20: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

20

GRelC Project - http://grelc.unile.it

Query Submission

• Let’s now retrieve a list of films whose length is longer than 90 minutes...

select * from film where length > 90

• Pretty cool! The GRelC Portal gives us a list of films

Page 21: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

21

GRelC Project - http://grelc.unile.it

Query Submission

• Why do not we search a list of actors involved in the films listed before?

select first_name, last_name, title, length from (film join film_actor on film.film_id=film_actor.film_id) join actor on actor.actor_id=film_actor.actor_id where length > 90

• 3 tables are now involved in our select query

Page 22: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

22

GRelC Project - http://grelc.unile.it

Query Submission

• What if we want to know the film category of the films listed before?

select category.name as category_name, first_name, last_name, title, length from (((film join film_actor on film.film_id=film_actor.film_id) join actor on actor.actor_id=film_actor.actor_id) join film_category on film.film_id = film_category.film_id) join category on category.category_id=film_category.category_id where length > 90

• 5 tables are now involved in our select query

Page 23: Sandro Fiore (sandro.fiore@unile.it) Alessandro Negro (alessandro.negro@unile.it)

23

GRelC Project - http://grelc.unile.it

Query Submission

• Let us now know who sells the films listed before, together with the category and the actors.

select category.name as category_name, first_name, last_name, title, length from (((film join film_actor on film.film_id=film_actor.film_id) join actor on actor.actor_id=film_actor.actor_id) join film_category on film.film_id = film_category.film_id) join category on category.category_id=film_category.category_id where length > 90

• 8 tables are now involved in our select query

• You can enrich the query as you want, no matter how many tables are involved. If the DBMS understands your query, the GRelC DAS understands it too!