# Reference code for db and column datatypes import MySQLdb mysql_username = 'root' mysql_password = '' mysql_host = 'localhost' mysql_feed_db = 'telegram_bot_feed' try: db = MySQLdb.connect(mysql_host,mysql_username,mysql_password,mysql_feed_db) cursor = db.cursor() # Create Table in PostgreSQL (articledb) ''' create_table_query = CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE TABLE articledb (uuid BINARY(16) PRIMARY KEY , article_id INT NOT NULL);''' #-------------------------------------------------------------------- # Create Table in PostgreSQL (userdb) ''' create_table_query = CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE TABLE userdb ( uuid BINARY(16) PRIMARY KEY , first_name VARCHAR(100), is_bot BOOLEAN NOT NULL, language_code VARCHAR(50), user_status BOOLEAN NOT NULL, created_at TIMESTAMP, modified_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);''' #-------------------------------------------------------------------- cursor.execute() db.commit() print("Table created successfully in MySQL ") #closing database connection. cursor.close() db.close() print("MySQL connection is closed") except Exception as e: print("Error while connecting to MySQL :", e)