-
Omega Account:
- You need an account on the Omega server at the University of Texas at Arlington.
-
SQL*Plus Access (optional):
- If you plan to use SQL*Plus, SQL Workbench, or SQL Developer, make sure you have one of these tools installed and configured.
-
Python 3:
- Python 3 must be installed on your system for running Python scripts.
-
cx_Oracle Python Package:
- Required for connecting to Oracle databases from Python scripts.
-
Setup the SSH Tunnel:
- To connect to the Oracle database from SQL Developer, SQL Workbench, SQL*Plus, or Python scripts, you need an SSH tunnel.
- Run the following command to create the SSH tunnel:
ssh -L 1523:acaddbprod.uta.edu:1523 username@omega.uta.edu
- Replace
username
with your Omega username. - This command forwards port 1523 to the Oracle server, making it accessible from your local machine.
-
Keep the SSH Tunnel Open:
- Make sure the SSH tunnel is running while using SQL tools or Python scripts to connect to the database.
-
SQL Tools Setup:
- Configure your SQL tool (SQL Developer, SQL Workbench, or SQL*Plus):
- Host:
localhost
- Port:
1523
- Service name:
pcse1p.data.uta.edu
- Host:
- Configure your SQL tool (SQL Developer, SQL Workbench, or SQL*Plus):
-
Use the provided
.sql
files to set up and manage the database:projectDBdrop.sql
: Drops existing tables, views, and triggers to reset the database.projectDBcreate.sql
: Creates the necessary tables, views, and triggers for the project.adhocQueries.sql
: Contains ad-hoc queries for various data operations and testing.projectDBqueries.sql
: Contains queries required for project submission.businessGoals.sql
: Contains queries related to buisness goals.
-
Open each
.sql
file in your SQL tool and execute them as needed to perform the required operations.
-
SSH Tunnel Requirement:
- An SSH tunnel is required if you are running the Python scripts from your local machine. The
dsn
in the script should be set tolocalhost
, which forwards to the Omega database through the SSH tunnel.
- An SSH tunnel is required if you are running the Python scripts from your local machine. The
-
Setting Up the Python Environment:
-
Install Python 3 from the official Python website.
-
Create a virtual environment (recommended):
python3 -m venv venv
- This will create a virtual environment named
venv
.
- This will create a virtual environment named
-
Activate the virtual environment:
- On Windows:
.\venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install
cx_Oracle
:pip install cx_Oracle
-
-
Running the Python Scripts:
-
Add Database Credentials:
- Edit the
credentials.py
file to enter your Omega username, password, and connection string. - Example:
username = 'your_username' password = 'your_password' dsn = 'localhost:1523/pcse1p.data.uta.edu'
- Ensure the SSH tunnel is open, as the script connects through
localhost
.
- Edit the
-
Run the Scripts:
- To create tables, execute:
python createAll.py
- To drop tables, execute:
python dropAll.py
- To create tables, execute:
-
If you want to insert all the necessary table, views, triggers and data into the database tables in a single run, you should use the runAllScripts.py
script. This script automates the process of executing multiple create, insert scripts sequentially, populating all the required tables.
To insert data in a single run, execute:
python runAllScripts.py
dropll.py
: Drops existing tables, views, and triggers.createAll.py
: Creates all tables, views, and triggers in the database.
insertLookupTables.py
: Inserts reference or lookup data.insertTravellers.py
: Inserts traveler data.insertGroups.py
: Inserts group data.insertServiceProviders.py
: Inserts service provider data.insertExpereinces.py
: Inserts experience data.insertBookings.py
: Inserts booking data.insertRatings.py
: Inserts rating data.
Make sure that:
- The SSH tunnel is open.
- You have configured
credentials.py
with the correct database credentials. - All insert scripts are present and properly configured.
- Stores database connection credentials such as the username, password, and connection string. Remember to edit this file to enter your database credentials before running any scripts.
- Creates the necessary database tables and triggers for the project. It contains the SQL commands to define the schema for each table.
- Creates views in the database, which are virtual tables representing the result of a query. Views can simplify data retrieval and improve query readability.
- Drops (deletes) the triggers and tables from the database. Useful for cleaning up or resetting the schema.
- Drops the views from the database, removing any virtual tables created with
createViews.py
.
- Inserts data into the
Fall24_S003_T8_Experience
table. This script adds records for different experiences using data generated from themocks.py
file or other sources.
- Adds data to the table that manages group-related information, such as group bookings or categories.
- Populates the lookup tables with reference data used across different tables. The data for these tables is typically provided in
mocks.py
.
- Inserts records into the
Fall24_S003_T8_Service_Providers
table, which stores information about service providers who offer various experiences.
- Adds records to the
Fall24_S003_T8_Travelers
table, representing travelers or users who participate in the experiences.
- Adds records to the
Fall24_S003_T8_Bookings
table, representing bookings done by travelers.
- Adds records to the
Fall24_S003_T8_Ratings
table, representing reviews recorded by travelers.
- Contains mock data used for populating the database. Includes lists of sample data such as city names, experience tags, categories, and other reference data.
- Contains config file where we can set number of travelers, service providers and so on.
- Contains table, views, triggers names to create or drop.
- Automates the process of running multiple insert scripts in a sequence to populate the database tables with initial data. If you want to insert all the data in a single run, use this script.
- SSH Tunnel Requirement:
- An SSH tunnel is required for both SQL tools and Python scripts when running them from your local machine. This is because the Omega database is not directly accessible from outside.
- Option 1 (SQL Tools): Run the
.sql
scripts using SQL*Plus, SQL Workbench, or SQL Developer with the SSH tunnel open. - Option 2 (Python Scripts): Run the
.py
scripts directly from the terminal. The SSH tunnel must be open, and the connection string should uselocalhost
as the host. - Single Run Data Insertion: Use
run_scripts_insert.py
to insert all data in one go.
-
Deactivating the Virtual Environment:
- After completing the operations, deactivate the virtual environment:
deactivate
- After completing the operations, deactivate the virtual environment:
-
SSH Tunnel Reminder:
- Always ensure that the SSH tunnel is open if you are running scripts from your local machine and connecting to Omega's database.
To ensure the database is set up correctly, follow these steps in the specified order:
-
Create Tables and Triggers
- Start by creating the necessary database tables and triggers. This defines the schema for each table that will be populated.
-
Lookup Tables
- Populate lookup tables with reference data, such as booking statuses, payment methods, and categories.
-
Travelers
- Insert traveler information, including personal details, preferences, and associated locations.
-
Traveler Groups
- Set up traveler groups, including group categories and membership information.
-
Service Providers
- Add service providers, including details about the services they offer.
-
Experiences
- Insert data related to experiences, including schedules, pricing, and associated service providers.
-
Bookings
- Populate the bookings table, associating travelers with their booked experiences.
-
Ratings
- Insert traveler ratings and feedback for the experiences they've participated in.
-
Drop Triggers and Tables
- If needed, you can drop the triggers and tables to clean up the database. This step removes all the data, trigger and table definitions.