daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest Nov 6th, 2018 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. connect_vk_1 = "12"
  2. connect_vk_2 = "31321"
  3. connect_vk_3 = "2141"
  4. connect_vk_4 = "2342"
  5.  
  6. connection = pymysql.connect(host=connect_host,
  7.                              user=connect_user,
  8.                              password=connect_pass,
  9.                              db=connect_db,
  10.                              charset=connect_charset,
  11.                              cursorclass=pymysql.cursors.DictCursor)
  12. print("База данных подключена успешно.")
  13. cursor = connection.cursor()
  14. cursor.execute("DROP TABLE IF EXISTS ACCOUNT")
  15. sql = """CREATE TABLE ACCOUNT (
  16.          LOGIN  CHAR(13) NOT NULL,
  17.          PASS  CHAR(13),
  18.          ID CHAR(15),  
  19.          ID_APP CHAR(10));
  20.          
  21.          INSERT INTO ACCOUNT VALUES("%s", "%s", "%s", "%s") % \
  22.                                    (connect_vk_1, connect_vk_2, connect_vk_3, connect_vk_4));"""
  23. cursor.execute("SELECT VERSION()")
  24. data = cursor.fetchone()
  25. print (f'Версия базы данных: {data} ')
  26. try:
  27.    connection.execute(sql, (connect_vk_1, connect_vk_2, connect_vk_3, connect_vk_4))
  28.    connection.commit()
  29. except:
  30.     connection.rollback()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top