Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alexander Jabbour
356 group 40 project
Commits
63c9a71a
Commit
63c9a71a
authored
Dec 23, 2021
by
Stefan Vercillo
Browse files
scripts working
parent
e34b2c76
Changes
10
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
63c9a71a
*.env
README.md
View file @
63c9a71a
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
...
...
api/cli/handle_parse.py
View file @
63c9a71a
...
...
@@ -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_ar
g
s
.
table
](
skip_creation
=
True
)
OBJ_CLS
=
controller
.
relation_2_class_map
[
delete_rows_
p
ars
er
.
table
](
skip_creation
=
True
)
OBJ_CLS
.
_delete_from_where
(
relation
=
delete_rows_ar
g
s
.
table
,
relation
=
delete_rows_
p
ars
er
.
table
,
conditions
=
conditions
,
)
...
...
api/models/courseInfo.py
View file @
63c9a71a
...
...
@@ -12,7 +12,6 @@ class CourseInfo(BaseModel):
def
__init__
(
self
,
course_offering_id
=
None
,
course_offering_length_in_days
=
None
,
semester
=
None
,
year
=
None
,
...
...
data_files/studentAssessment.csv
→
data_files/studentAssessment
s
.csv
View file @
63c9a71a
File moved
run.sh
deleted
100755 → 0
View file @
e34b2c76
#!/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"
scripts/run.sh
View file @
63c9a71a
...
...
@@ -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
=
"
e
ducation"
db_name
=
"
E
ducation"
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"
...
...
scripts/script4.sql
View file @
63c9a71a
...
...
@@ -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
;
...
...
scripts/update_course_offering_date.py
View file @
63c9a71a
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;"
)
...
...
scripts/update_imd_band.py
View file @
63c9a71a
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
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment