コード例 #1
0
    def create_table_curso(self):

        try:
            conn = Connection('curso')
            query = '''
                    CREATE TABLE IF NOT EXISTS curso(
                        id SERIAL PRIMARY KEY NOT NULL,
                        curso VARCHAR(50) NOT NULL
                    );
                '''
            conn.execute_query(query)
            conn.commit()

        except Exception as e:
            print(e)
コード例 #2
0
    def create_table_seccion(self):

        try:
            conn = Connection('seccion')
            query = '''
                CREATE TABLE IF NOT EXISTS seccion(
                    id SERIAL PRIMARY KEY NOT NULL,
                    grado VARCHAR (50) NOT NULL,
                    seccion VARCHAR (10) NOT NULL
                );
            
            '''
            conn.execute_query(query)
            conn.commit()

        except Exception as e:
            conn.rollback()
            print(e)
コード例 #3
0
    def create_table_prof(self):

        try:
            conn = Connection('Profesor')
            query = '''
                CREATE TABLE IF NOT EXISTS profesor(
                    id SERIAL PRIMARY KEY NOT NULL,
                    nombre VARCHAR(50) NOT NULL,
                    apellido VARCHAR(50) NOT NULL,
                    DNI INTEGER NOT NULL,
                    Correo VARCHAR (50) NOT NULL,
                    Telefono INTEGER NOT NULL
                );
            '''
            conn.execute_query(query)
            conn.commit()

        except Exception as e:
            conn.rollback()
            print(e)
コード例 #4
0
    def create_table_nota(self):

        try:
            conn = Connection('nota')
            query = '''
                    CREATE TABLE IF NOT EXISTS nota(
                        id SERIAL PRIMARY KEY NOT NULL,
                        alumno_id integer NOT NULL,
                        curso_id integer NOT NULL,
                        Nota_1 real NOT NULL,
                        Nota_2 real NOT NULL,
                        Nota_3 real NOT NULL,
                        Nota_4 real NOT NULL
                    );
                '''
            conn.execute_query(query)
            conn.commit()

        except Exception as e:
            conn.rollback()
            print(e)
コード例 #5
0
ファイル: Alumno.py プロジェクト: faquino012/reto_sem6
 def create_table(self):
     try:
         conn = Connection('alumno')
         query = '''
             CREATE TABLE IF NOT EXISTS public.alumno
             (
                 id integer NOT NULL,
                 documento character varying(20) NOT NULL,
                 nombre character varying(100) NOT NULL,
                 fecha_de_nacimiento date NOT NULL,
                 correo character varying(50) NOT NULL,
                 estado boolean NOT NULL,
                 genero character varying(1) NOT NULL,
                 PRIMARY KEY (id)
             );
         '''
         conn.execute_query(query)
         conn.commit()
     except Exception as e:
         conn.rollback()
         print(e)
コード例 #6
0
    def create_table_alumno(self):

        try:
            conn = Connection('alumnos')
            query = '''
                CREATE TABLE IF NOT EXISTS alumnos(
                    id SERIAL PRIMARY KEY NOT NULL,
                    Nombre VARCHAR (50) NOT NULL,
                    Apellido VARCHAR (50) NOT NULL,
                    Edad INTEGER NOT NULL,
                    DNI INTEGER NOT NULL,
                    grado VARCHAR (20),
                    Seccion INTEGER
                );
            '''

            conn.execute_query(query)
            conn.commit()

        except Exception as e:
            conn.rollback()
            print(e)