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
Loading the Database
Download the database file Chinook_Python.py and place it in the 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:
select(relation, predicate)
project(relation, columns)
rename(relation, new_columns=None, new_relation=None)
cross(relation1, relation2)
theta_join(relation1, relation2, predicate)
Implement natural_join(relation1, relation2).
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:
Combining 𝜎 and ⨯ to implement 𝜃-join Performing 𝜎 after 𝜃-join Performing 𝜎 before 𝜃-join Natural join (Run this If you did the extra credit.)
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 the “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.
In this, we can creating database using python file and also implements these database queries using the python script. We know it is some different things than the other queries like MySQL or MongoDB.
If you need help like different databases than please contact us or comments in the below section so that we can provide help to you.