-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbmake.py
More file actions
46 lines (28 loc) · 1.13 KB
/
dbmake.py
File metadata and controls
46 lines (28 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import sqlite3
def db_main():
conn = sqlite3.connect('juga_base.db')
cur = conn.cursor()
#cur.execute( '''DROP TABLE jugador''' )
cur.execute( ''' CREATE TABLE jugador
(codigo integer PRIMARY KEY, nombre text, club text, posicion text, costo real) ''' )
cur.execute(''' CREATE TABLE ojeo
(codigo integer PRIMARY KEY, codigo_jugador integer, comentarios text, fecha text, FOREIGN KEY(codigo_jugador) REFERENCES jugador(codigo))
''')
#cur.execute( )
conn.commit()
conn.close()
def db_test():
conn = sqlite3.connect('juga_base_test.db')
cur = conn.cursor()
#cur.execute( '''DROP TABLE jugador''' )
cur.execute( ''' CREATE TABLE jugador
(codigo integer PRIMARY KEY, nombre text, club text, posicion text, costo real) ''' )
cur.execute(''' CREATE TABLE ojeo
(codigo integer PRIMARY KEY, codigo_jugador integer, comentarios text, fecha text, FOREIGN KEY(codigo_jugador) REFERENCES jugador(codigo))
''')
#cur.execute( )
conn.commit()
conn.close()
if __name__ == "__main__":
db_main()
db_test()