Assignment due November 3
RDBMS and Database
The RDBMS for this project is a Python program that you and your
team will implement.
The database is Luis Rocha’s Chinook
Database, modified for use with Python. I will provide
this database.
Platforms
Python 3.6.8.
Loading the Database
Download the database file Chinook_Python.py and place it in directory where you will develop your Python
code. The database can be loaded with the following command:
from Chinook_Python import *
You will find variables named Artist, Album, Customer, etc. containing sets of namedtuple objects.
Note: an earlier version of Chinook_Python.py did not export the InvoiceLine relation by default.
You can import it explicitly (e.g., from Chinoook_Python import InvoiceLine), or use the link above to download an updated version.
Relational Operators
Task: 1 Implement the following functions in Python:
The predicate for select() should be a function
that takes a single namedtuple as an argument and returns True or False.
The predicate for theta_join() should take two namedtuples and return a bool.
The new_columns and new_relation parameters to rename() are optional. if
neither argument is provided, return the original relation.
Queries
The file queries.py contains four variations of the query:
All of the queries
above should return the following set:
{Result(Title='Blood Sugar Sex Magik'),
Result(Title='By The Way'),
Result(Title='Californication')}
Task 2: When the relational operators are implemented and the
queries above work correctly, write code to run the following query from.
Names of the support representatives
whose customers bought tracks in “Purchased AAC audio file” format.
Performance Measurement
As a rough approximation of the processing required for each
query, instrument your functions to measure the cardinality of the result set
for each relational operator. When a query completes, print the total number of
tuples returned during processing.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
23 | 24 | 25 | 26 | 27 | 28 | 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 1 | 2 | 3 | 4 | 5 |
Get Free Quote!
380 Experts Online