Exemplo n.º 1
0
def main():
	while(True):
		print("\n[1] CREATE TABLE\n[2] READ TABLE\n[3] ADD ENTRY\n[x] EXIT")
		choice = input("> ")
		if (choice == "1"):
			create.create_table()
			break
		elif (choice == "2"):
			read.read_entries()
			break
		elif (choice == "3"):
			entry.insert_entry()
			break
		elif (choice == "x"):
			sys.exit()
		else:
			print("Choose from 1-3, and x only!");
Exemplo n.º 2
0
import time
import psycopg2
from create import create_table
from populate import populate_table
from select import select_table
from config import db_config

conn = None
retries = 30

while retries:
    try:
        conn = psycopg2.connect(**db_config)
        break
    except Exception as err:
        print(err)
        retries -= 1
        print('Retries -', retries)
        time.sleep(1)

try:
    create_table(conn)
    populate_table(conn)
    select_table(conn)
except Exception as err:
    print(err)
finally:
    if conn is not None:
        conn.close()
Exemplo n.º 3
0
        print_menu()
        choice = int(input("Enter your choice [1-6]:"))
        if choice == 1:
            clear()
            add()
        elif choice == 2:
            clear()
            list_all()
        elif choice == 3:
            clear()
            report()
        elif choice == 4:
            clear()
            update()
        elif choice == 5:
            clear()
            delete()
        elif choice == 6:
            print("Exit")
            conn.close()
            exit(1)
            break
        else:
            clear()
            print("Wrong option selection.")


if __name__ == '__main__':
    create_table()
    main()
Exemplo n.º 4
0
Arquivo: dbms.py Projeto: formin/dbms
import select
import insert
import create

stype = int(raw_input('Enter an integer 1.create table 2.insert table 3.select table : '))

if stype == 1:
 create.create_table()
elif stype == 2:
 insert.insert_table()
elif stype == 3:
 select.select_table()
else:
 print 'exit'