Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import psycopg2
- conn = psycopg2.connect(user = "#######",
- password = "###########",
- host = "psql.wmi.amu.edu.pl",
- database ="##########")
- cursor = conn.cursor()
- myinput = input("Wprowadź nazwe tabeli: ")
- myallinput = 'SELECT * FROM '+myinput
- cursor.execute(myallinput)
- j=0
- column =""
- for i in cursor.description:
- column +=" "+ cursor.description[j][0] +" "
- j+=1
- print(column)
- print("")
- j=0
- x=""
- q=1
- for table in cursor.fetchall():
- for i in cursor.description:
- x +=str(table[j]) +" "
- j += 1
- print(str(q)+"|"+" "+x)
- x=""
- j=0
- q+=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement