DJ On Demand SQL Project report
Objective:
The "DJ on Demand" project aims to develop a real-time database application
using Flask, a web framework, to manage DJ event services. The system
integrates multiple entities related to event planning, such as clients, venues,
events, partners, music CDs, songs, and playlists. By leveraging an Entity-
Relationship (ER) model, the project applies normalization principles and
incorporates SQL and PL/SQL features for data integrity and efficiency.
Key Components:
1. Database Schema:
The database consists of multiple interconnected tables, including:
o D_CDS: Stores details about music CDs.
o D_CLIENTS: Manages client information (e.g., name, contact,
email).
o D_PACKAGES: Defines available event packages with pricing
ranges.
o D_THEMES: Describes themes available for events.
o D_VENUES: Captures venue details like rental fees and addresses.
o D_EVENTS: Contains event-specific data (e.g., event name, date,
description, venue, client, cost).
o D_PARTNERS: Includes information about event coordinators,
DJs, and other partners.
o D_JOB_ASSIGNMENTS: Tracks which partner is assigned to
which event and their responsibilities.
o D_SONGS: Stores song details, including title, duration, artist, and
type.
o D_PLAY_LIST_ITEMS: Links songs to events and allows
comments (e.g., "Play after cake cutting").
o D_TRACK_LISTINGS: Associates songs with specific tracks on
CDs.
2. ER Diagram:
3. SQL and PL/SQL Features:
The database uses primary keys, foreign keys, indexes, and constraints to
maintain referential integrity and optimize performance. SQL queries
handle insertion, updates, and deletions, while PL/SQL might be used for
more complex business logic (e.g., triggers for notifications or handling
specific event rules).
4. Web Application:
The application provides a user-friendly interface for managing entities
such as clients, events, and playlists. Built with Flask, it includes
functionalities to:
o View entities (e.g., client profiles, event details, playlists).
o Add new entities (e.g., a new song, partner, or event).
o Update existing entities (e.g., modifying an event description or
playlist).
o Delete entities (e.g., removing a song from a playlist).
o Search and filter entities based on specific criteria (e.g., search for
events by client or filter songs by type).
5. Database Operations:
The application interacts with the database through a custom dbConnect
module. This module handles database connections and executes SQL
queries (e.g., INSERT, SELECT, UPDATE, DELETE).
6. User Interaction:
The interface allows users to manage event details, select music from a
list of songs, assign them to specific events, and update event status. The
system also provides feedback messages using flash() to notify users of
successful actions or errors (e.g., "Event added successfully" or "Failed to
add song").
7. Error Handling:
The project incorporates error handling to ensure that invalid actions
(such as attempting to add a song with missing fields or violating foreign
key constraints) are properly caught and communicated to users.
8. Main Execution:
The Flask application runs in debug mode, enabling real-time changes
and easy troubleshooting. Users can interact with the application via web
pages rendered through Flask's render_template().
9. Separate viewEvents website: It is used to view Evants data.
Success.html alert whether data added successfully
Summary of syntax used in python
import cx_Oracle: Used to connect python with Oracle database.
dbConnect.py is linked to app.py in a way db.Connect has configParser
1. Import Statements:
- Flask: Web framework for creating the application.
- render_template, request, etc.: Flask modules for handling web requests and
responses.
- dbConnect: Custom module for database operations.
2. Application Setup:
- app = Flask(__name__): Initializes the Flask application.
- app.secret_key: Sets a secret key for session management.
3. Route Definitions:
- @app.route('/'): Defines the home page route.
- @app.route('/add_entity', methods=['POST']): Handles entity addition.
- @app.route('/update_entity', methods=['POST']): Handles entity updates.
- @app.route('/delete_entity', methods=['POST']): Handles entity deletion.
- @app.route('/view_entity', methods=['POST']): Handles entity viewing.
4. Database Operations:
- dbConnect.read_db_config(): Reads database configuration.
- dbConnect.execute_sql(): Executes SQL queries.
5. Request Handling:
- request.form[]: Retrieves form data submitted by the user.
6. Response Rendering:
- render_template(): Renders HTML templates with data.
- flash(): Provides feedback messages to the user.
7. Error Handling:
- try-except blocks: Handle potential errors in database operations.
8. Main Execution:
- if __name__ == '__main__': Runs the Flask application in debug mode.
SYNTAX:
python
from flask import Flask, render_template, request, redirect, url_for, flash
import dbConnect
app = Flask(__name__)
app.secret_key = 'supersecretkey'
@app.route('/')
def home():
return render_template('index.html')
@app.route('/add_entity', methods=['POST'])
def add_entity():
# Entity addition logic
return render_template('success.html')
@app.route('/update_entity', methods=['POST'])
def update_entity():
# Entity update logic
return render_template('success.html')
@app.route('/delete_entity', methods=['POST'])
def delete_entity():
# Entity deletion logic
return render_template('success.html')
@app.route('/view_entity', methods=['POST'])
def view_entity():
# Entity viewing logic
return render_template('view.html', data=data)
if __name__ == '__main__':
app.run(debug=True)
dbConnect.execute_sql(query): to execute give query connected to Oracle
database.
Conclusion:
The "DJ on Demand" project showcases how web technologies and database
management principles can be applied to create a real-time event management
system. It provides an efficient way for clients, partners, and event planners to
coordinate and organize events, ensuring smooth management of playlists,
venues, and partner assignments. Through its web interface, users can easily
interact with the system, leveraging the power of an integrated relational
database backend.