Commit 63c9a71a authored by Stefan Vercillo's avatar Stefan Vercillo
Browse files

scripts working

parent e34b2c76
Configuring inital DB
CREATING DB:
requirements: python3 , pip3, python-mysql-connector
```
cd scripts;
./run.sh
```
runs the following files sequentially:
cd to scripts run:
script1.sql
script1.sql (note path to csv needs to be updated for user running script)
script2.sql
script3.sql
python3 update_course_offering_date.py # with mysql-connector pip module installed
......
......@@ -147,10 +147,10 @@ def delete_base_func(command):
conditions.append(Filter(Attributes(f['attribute']), Operator(f['operator']), AttributeValue(f['value'])))
OBJ_CLS = controller.relation_2_class_map[delete_rows_args.table](skip_creation=True)
OBJ_CLS = controller.relation_2_class_map[delete_rows_parser.table](skip_creation=True)
OBJ_CLS._delete_from_where(
relation=delete_rows_args.table,
relation=delete_rows_parser.table,
conditions=conditions,
)
......
......@@ -12,7 +12,6 @@ class CourseInfo(BaseModel):
def __init__(
self,
course_offering_id = None,
course_offering_length_in_days=None,
semester=None,
year=None,
......
#!/bin/bash
# ** README **
# Requirements:
# 1. mysql-connector pip module installed
# 2. local path to loading data files updated in script1
# 3. input your database name for the db_name variable
# 4. update connection info inside the python scripts
db_name="ece356"
mysql -u root --verbose --verbose $db_name < "scripts/script1.sql"
mysql -u root --verbose --verbose $db_name < "scripts/script2.sql"
mysql -u root --verbose --verbose $db_name < "scripts/script3.sql"
#tested up to there ^
python3 scripts/update_course_offering_date.py
python3 scripts/update_imd_band.py
mysql -u root --verbose --verbose $db_name < "scripts/script4.sql"
......@@ -5,9 +5,9 @@
# 1. mysql-connector pip module installed
# 2. local path to loading data files updated in script1
# 3. input your database name for the db_name variable
db_name="education"
db_name="Education"
user="snvercil"
password="PASSWORD"
password="pass"
mysql -u $user --password=$password --verbose --verbose $db_name < "script1.sql"
mysql -u $user --password=$password --verbose --verbose $db_name < "script2.sql"
......
......@@ -61,6 +61,16 @@ create table courseInfo (
insert into courseInfo (course_code)
select distinct code_module from courseOfferings;
alter table courseOfferings
add column course_id INT,
add constraint foreign key(course_id) references courseInfo(course_id);
UPDATE courseOfferings LEFT JOIN courseInfo ON courseOfferings.code_module = courseInfo.course_code
SET courseOfferings.course_id = courseInfo.course_id;
alter table courseOfferings
drop column code_module,
drop column code_presentation,
......@@ -78,7 +88,6 @@ alter table assessments
drop column assessment_type_o;
drop table Courses;
alter table studentInfo
drop column highest_education;
......
import mysql.connector
# cnx = mysql.connector.connect(host='localhost', user='snvercil', database='Education', password="32darklink")
cnx = mysql.connector.connect(host='127.0.0.1', user='root', database='ece356')
cnx = mysql.connector.connect(host='localhost', user='snvercil', database='Education', password="sdfsdf")
cursor = cnx.cursor()
cursor.execute("USE ece356;")
# cursor.execute("USE ece356;")
cursor.execute("SELECT * FROM courseOfferings;")
......
import mysql.connector
# cnx = mysql.connector.connect(host='localhost', user='snvercil', database='Education', password="32darklink")
cnx = mysql.connector.connect(host="127.0.0.1", user="root", database="ece356")
cnx = mysql.connector.connect(host='localhost', user='snvercil', database='Education', password="pass")
cursor = cnx.cursor()
cursor.execute("USE ece356;")
cursor.execute("SELECT * FROM studentInfo;")
c = cursor.fetchall()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment