Exemplo n.º 1
0
def create_fees_table():
    execute_query(query='''
               CREATE TABLE fees
                         (
                           ID SERIAL PRIMARY KEY,
                           REGNO  VARCHAR(255) REFERENCES students(REGNO),
                           FEE_PAYMENT         REAL
                         ); ''')
Exemplo n.º 2
0
def create_master_students_table():
    execute_query(query='''CREATE TABLE students2
                         (
                           ID SERIAL,
                           REGNO   VARCHAR(255) PRIMARY KEY,
                           CAMPUS         TEXT      NOT NULL,
                           YEAROFSTUDY    INT       NOT NULL
                         ); ''')
Exemplo n.º 3
0
def create_projects_table():
    execute_query(query='''
               CREATE TABLE projects
                         (
                           ID SERIAL PRIMARY KEY,
                           REGNO  VARCHAR(255) REFERENCES students(REGNO),
                           PROJECT_NAME  VARCHAR  NOT NULL,
                           DEPARTMENT VARCHAR   NOT NULL,
                           SUPERVISOR VARCHAR     NOT NULL
                         ); ''')
Exemplo n.º 4
0
def fetch_fragment_chiromo():
    execute_query(
        query="select * from students_chiromo",
        host=site_chiromo['host'],
    )

    # FETCH PARAMETARIZED DATA

    execute_query(
        query="select * from students_chiromo where id = 1",
        host=site_chiromo['host'],
    )
Exemplo n.º 5
0
def create_fragment_chiromo():
    students_records = execute_query(
        query="select * from students where campus = 'CHIROMO'",
        host=master_students_db['host'])
    execute_query(query='''CREATE TABLE students_chiromo
                  (
                      ID     INT     UNIQUE    NOT NULL,
                      REGNO  VARCHAR UNIQUE    NOT NULL,
                      CAMPUS         TEXT      NOT NULL,
                      YEAROFSTUDY    INT       NOT NULL
                  ); ''',
                  host=site_chiromo['host'])

    insert_records_query(records_to_insert=students_records,
                         query="""
            INSERT INTO students_chiromo (
            ID, REGNO, CAMPUS, YEAROFSTUDY
            ) VALUES %s
            """,
                         host=site_chiromo['host'])
Exemplo n.º 6
0
def create_fragment_kabete():
    students = []
    students_records = execute_query(
        query="select * from students where campus = 'KABETE'",
        host=master_students_db['host'])
    execute_query(query='''CREATE TABLE students_kabete
                  (
                      ID     INT     UNIQUE    NOT NULL,
                      REGNO  VARCHAR UNIQUE    NOT NULL,
                      CAMPUS         TEXT      NOT NULL,
                      YEAROFSTUDY    INT       NOT NULL
                  ); ''',
                  host=site_kabete['host'])

    # TODO: Create A Mass Insert Function

    insert_records_query(records_to_insert=students_records,
                         query="""
            INSERT INTO students_kabete (
            ID, REGNO, CAMPUS, YEAROFSTUDY
            ) VALUES %s
            """,
                         host=site_kabete['host'])
Exemplo n.º 7
0
def fetch_fee_data():
    execute_query(query="select * from fees")
Exemplo n.º 8
0
def fetch_master_data():
    execute_query(query="select * from students")
Exemplo n.º 9
0
def fetch_projects_data():
    execute_query(query="select * from projects")
Exemplo n.º 10
0
def delete_data_from_master():
    execute_query(query="Delete from students where id = 10")