1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import psycopg2 from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT # Connect to PostgreSQL DBMS con = psycopg2.connect("user=postgres password='abc'"); con.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT); # Obtain a DB Cursor cursor = con.cursor(); name_Database = "socialmedia"; # Create table statement sqlCreateDatabase = "create database "+name_Database+";" # Create a table in PostgreSQL database cursor.execute(sqlCreateDatabase); |
コメントを残す