Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pymysql.cursors
- host_name = input("Enter host name : ")
- user = input('Enter username for database : ')
- psw = input('Enter password for database : ')
- db_name = input("Enter database name : ")
- task1 = input("Do you want to insert data")
- connection = pymysql.connect(host= host_name,
- user= user,
- password= psw,
- db= db_name,
- charset='utf8mb4',
- cursorclass=pymysql.cursors.DictCursor)
- table_name = input("Enter table name : ")
- with connection.cursor() as cursor:
- sql = "SELECT '*' FROM 'users';"
- cursor.execute(sql)
- result = cursor.fetchall()
- print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement