示例#1
0
 def registro_alumno_curso(self, idcursoprofesor, idalumnogrado, nota=''):
     try:
         conn = Connection()
         query = f'''
             INSERT INTO registro_alumno_curso(idcursoprofesor, idalumnogrado)
                 VALUES({idcursoprofesor}, {idalumnogrado});
         '''
         conn.execute_query(query)
     except Exception as e:
         print(f'Error -> {str(e)}')
     finally:
         conn.close_connection()
示例#2
0
 def aperturar_alumno_grado(self, id_apertura, id_alumno):
     try:
         conn = Connection()
         query = f'''
             INSERT INTO apertura_alumno_grado(idapertura, idalumno)
                 VALUES({id_apertura}, {id_alumno});
         '''
         conn.execute_query(query)
     except Exception as e:
         print(f'Error -> {str(e)}')
     finally:
         conn.close_connection()
示例#3
0
 def consultar_anio_todos(self):
     try:
         conn = Connection()
         query = f'''
             SELECT id, anio, descripcion
                 FROM anio_escolar;
         '''
         cursor = conn.execute_query(query)
         self.lista_anio = cursor.fetchall()
     except Exception as e:
         print(f'Error -> {str(e)}')
     finally:
         conn.close_connection()
示例#4
0
 def consultar_alumno_todos(self):
     try:
         conn = Connection()
         query = f'''
             SELECT id, nombres, apellido_pat, apellido_mat
                 FROM alumno;
         '''
         cursor = conn.execute_query(query)
         self.lista_alumno = cursor.fetchall()
     except Exception as e:
         print(f'Error -> {str(e)}')
     finally:
         conn.close_connection()
示例#5
0
    def aperturar_anio_escolar(self, idanio, idgrado):
        try:
            conn = Connection()
            query = f'''
                INSERT INTO apertura_alumno_grado(idanio, idgrado)
                    VALUES({idanio}, {idgrado});
            '''
            conn.execute_query(query)
        except Exception as e:
            print(f'Error -> {str(e)}')
        finally:
            conn.close_connection()


#A=anio_escolar('2020','Dos mil veinte')
#A.guardar_anio_escolar()
#A.fetchone_alumno()
#A.fetchall_anio_escolar()
示例#6
0
 def consultar_anio_id(self):
     try:
         conn = Connection()
         query = f'''
             SELECT id, anio, descripcion
             FROM anio_escolar
             WHERE id = {self.id};
         '''
         cursor = conn.execute_query(query)
         self.lista_anio = cursor.fetchall()
         for anio in self.lista_anio:
             self.id = anio[0]
             self.anio = anio[1]
             self.descripcion = anio[2]
     except Exception as e:
         print(f'Error -> {str(e)}')
     finally:
         conn.close_connection()
示例#7
0
 def consultar_alumno_id(self):
     try:
         conn = Connection()
         query = f'''
             SELECT id, nombres, apellido_pat, apellido_mat
             FROM alumno
             WHERE id = {self.id};
         '''
         cursor = conn.execute_query(query)
         self.lista_alumno = cursor.fetchall()
         for alumno in self.lista_alumno:
             self.id = alumno[0]
             self.nombres = alumno[1]
             self.apellido_pat = alumno[2]
             self.apellido_mat = alumno[3]
     except Exception as e:
         print(f'Error -> {str(e)}')
     finally:
         conn.close_connection()
示例#8
0
 def consultar_alumno_grado(self, idapertura):
     try:
         conn = Connection()
         query = f'''
             SELECT A.id, A.nombres, A.apellido_pat, A.apellido_mat
             FROM alumno A
             Inner join apertura_alumno_grado B on A.id = B.idalumno                
             WHERE B.idapertura={idapertura};
         '''
         cursor = conn.execute_query(query)
         self.lista_alumno = cursor.fetchall()
         for alumno in self.lista_alumno:
             self.id = alumno[0]
             self.nombres = alumno[1]
             self.apellido_pat = alumno[2]
             self.apellido_mat = alumno[3]
     except Exception as e:
         print(f'Error -> {str(e)}')
     finally:
         conn.close_connection()
示例#9
0
    def registro_nota_periodo_alumno(self,
                                     idalumnocurso,
                                     idperiodoeval,
                                     nota=''):
        try:
            conn = Connection()
            query = f'''
                INSERT INTO registro_nota_periodo_alumno(idalumnocurso, idperiodoeval,nota)
                    VALUES({idalumnocurso}, {idperiodoeval},{nota});
            '''
            conn.execute_query(query)
        except Exception as e:
            print(f'Error -> {str(e)}')
        finally:
            conn.close_connection()


#A=Alumno('','Carmen','Laos','Rios')
#A.guardar_alumno()
#A.fetchone_alumno()
#A.fetchall_alumno()
示例#10
0
 def consultar_alumno_nombre(self, nombre, anio):
     try:
         conn = Connection()
         query = f'''
             SELECT A.id, A.nombres, A.apellido_pat, A.apellido_mat
             FROM alumno A
             Inner join apertura_alumno_grado B on A.id = B.idalumno
             Inner join apertura_escolar C on B.idapertura=C.id  
             Inner join anio_escolar D on C.idanio=D.id             
             WHERE D.anio='{anio}' and A.nombres like '%{nombre}%';
         '''
         cursor = conn.execute_query(query)
         self.lista_alumno = cursor.fetchall()
         for alumno in self.lista_alumno:
             self.id = alumno[0]
             self.nombres = alumno[1]
             self.apellido_pat = alumno[2]
             self.apellido_mat = alumno[3]
     except Exception as e:
         print(f'Error -> {str(e)}')
     finally:
         conn.close_connection()
示例#11
0
            CREATE TABLE IF NOT EXISTS registro_nota_periodo_alumno(
                id SERIAL PRIMARY KEY NOT NULL,
                idalumnocurso INTEGER NOT NULL,
                idperiodoeval INTEGER NOT NULL,
                nota INT2 NOT NULL,
                FOREIGN KEY (idalumnocurso) REFERENCES registro_alumno_curso(id),
                FOREIGN KEY (idperiodoeval) REFERENCES periodo_tipo_evaluacion(id)
            );
        '''
        conn.execute_query(create_table_query)
        conn.commit()
  

conn = Connection()
database= Database(conn)
database.crear_profesor()
database.crear_alumno()
database.crear_salon()
database.crear_nivel_educativo()
database.crear_curso()
database.crear_periodo_tipo_evaluacion()
database.crear_anio_escolar()
database.crear_grado_salon()
database.crear_apertura_escolar()
database.crear_apertura_curso_profesor()
database.crear_apertura_alumno_grado()
database.crear_registro_alumno_curso()
database.crear_registro_nota_periodo_alumno()
conn.close_connection()