Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- connect_vk_1 = "12"
- connect_vk_2 = "31321"
- connect_vk_3 = "2141"
- connect_vk_4 = "2342"
- connection = pymysql.connect(host=connect_host,
- user=connect_user,
- password=connect_pass,
- db=connect_db,
- charset=connect_charset,
- cursorclass=pymysql.cursors.DictCursor)
- print("База данных подключена успешно.")
- cursor = connection.cursor()
- cursor.execute("DROP TABLE IF EXISTS ACCOUNT")
- sql = """CREATE TABLE ACCOUNT (
- LOGIN CHAR(13) NOT NULL,
- PASS CHAR(13),
- ID CHAR(15),
- ID_APP CHAR(10));
- INSERT INTO ACCOUNT VALUES("%s", "%s", "%s", "%s") % \
- (connect_vk_1, connect_vk_2, connect_vk_3, connect_vk_4));"""
- cursor.execute("SELECT VERSION()")
- data = cursor.fetchone()
- print (f'Версия базы данных: {data} ')
- try:
- connection.execute(sql, (connect_vk_1, connect_vk_2, connect_vk_3, connect_vk_4))
- connection.commit()
- except:
- connection.rollback()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement