forked from oracle-samples/oracle-db-examples
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSetupSamples.py
33 lines (26 loc) · 1.23 KB
/
SetupSamples.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#------------------------------------------------------------------------------
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# 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 SampleEnv
import DropSamples
# connect as administrative user (usually SYSTEM or ADMIN)
conn = cx_Oracle.connect(SampleEnv.GetAdminConnectString())
# drop existing users and editions, if applicable
DropSamples.DropSamples(conn)
# create sample schema and edition
print("Creating sample schemas and edition...")
SampleEnv.RunSqlScript(conn, "SetupSamples",
main_user = SampleEnv.GetMainUser(),
main_password = SampleEnv.GetMainPassword(),
edition_user = SampleEnv.GetEditionUser(),
edition_password = SampleEnv.GetEditionPassword(),
edition_name = SampleEnv.GetEditionName())
print("Done.")