Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pymysql.cursors
- import json
- connect_host = 'localhost'
- connect_user = 'root'
- connect_pass = ''
- connect_db = 'bot-one'
- connect_charset = 'utf8mb4'
- connect_vk_login = '12'
- connect_vk_pass = '123'
- connect_vk_id = '09934'
- connect_vk_app = '77362'
- 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()
- sql = """CREATE TABLE ACCAUNT (
- LOGIN INT NOT NULL,
- PASS INT,
- ID INT,
- ID_APP INT )"""
- cursor.execute(sql)
- #======= Переделать то что внизу ==========
- sql = "INSERT INTO ACCAUNT(LOGIN, \
- PASS, ID, ID_APP) \
- VALUES ('str', 'str', 'str, 'str' )" % \
- (connect_vk_login, connect_vk_pass, connect_vk_id, connect_vk_app)
- try:
- cursor.execute(sql)
- connection.commit()
- except:
- connection.rollback()
- connection.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement