Пример #1
0
def drop_samples(conn):
    print("Dropping sample schemas and edition...")
    sample_env.run_sql_script(conn,
                              "drop_samples",
                              main_user=sample_env.get_main_user(),
                              edition_user=sample_env.get_edition_user(),
                              edition_name=sample_env.get_edition_name())
Пример #2
0
#------------------------------------------------------------------------------
# SetupSamples.py
#
# Creates users and populates their schemas with the tables and packages
# necessary for the cx_Oracle samples. An edition is also created for the
# demonstration of PL/SQL editioning.
#------------------------------------------------------------------------------

import cx_Oracle

import sample_env
import DropSamples

# connect as administrative user (usually SYSTEM or ADMIN)
conn = cx_Oracle.connect(sample_env.get_admin_connect_string())

# drop existing users and editions, if applicable
DropSamples.drop_samples(conn)

# create sample schema and edition
print("Creating sample schemas and edition...")
sample_env.run_sql_script(conn,
                          "SetupSamples",
                          main_user=sample_env.get_main_user(),
                          main_password=sample_env.get_main_password(),
                          edition_user=sample_env.get_edition_user(),
                          edition_password=sample_env.get_edition_password(),
                          edition_name=sample_env.get_edition_name())
print("Done.")