Skip to content

Commit 1575e1e

Browse files
cjbjgvenzl
andauthored
Update python-oracledb examples (#409)
Signed-off-by: Christopher Jones <christopher.jones@oracle.com> Co-authored-by: Gerald Venzl <gerald.venzl@oracle.com>
1 parent 29f9812 commit 1575e1e

File tree

105 files changed

+568
-164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+568
-164
lines changed

python/python-oracledb/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ build a container with the samples and a running Oracle Database.
3434

3535
### Notebooks
3636

37-
The [sample_notebooks](./sample_notebooks) directory has Jupyter notebooks with
38-
runnable examples.
37+
The [notebooks](./notebooks) directory has Jupyter notebooks with runnable
38+
examples.
3939

4040
## About python-oracledb
4141

python/python-oracledb/app_context.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2016, 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2016, 2024, Oracle and/or its affiliates.
33
#
44
# Portions Copyright 2007-2015, Anthony Tuininga. All rights reserved.
55
#
@@ -38,8 +38,9 @@
3838
import oracledb
3939
import sample_env
4040

41-
# this script is currently only supported in python-oracledb thick mode
42-
oracledb.init_oracle_client(lib_dir=sample_env.get_oracle_client())
41+
# determine whether to use python-oracledb thin mode or thick mode
42+
if not sample_env.get_is_thin():
43+
oracledb.init_oracle_client(lib_dir=sample_env.get_oracle_client())
4344

4445
# client context attributes to be set
4546
APP_CTX_NAMESPACE = "CLIENTCONTEXT"

python/python-oracledb/array_dml_rowcounts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2016, 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2016, 2024, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -42,6 +42,7 @@
4242
user=sample_env.get_main_user(),
4343
password=sample_env.get_main_password(),
4444
dsn=sample_env.get_connect_string(),
45+
params=sample_env.get_connect_params(),
4546
)
4647

4748
with connection.cursor() as cursor:

python/python-oracledb/array_dml_rowcounts_async.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -44,6 +44,7 @@ async def main():
4444
user=sample_env.get_main_user(),
4545
password=sample_env.get_main_password(),
4646
dsn=sample_env.get_connect_string(),
47+
params=sample_env.get_connect_params(),
4748
)
4849

4950
with connection.cursor() as cursor:

python/python-oracledb/async_gather.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -66,6 +66,7 @@ async def main():
6666
user=sample_env.get_main_user(),
6767
password=sample_env.get_main_password(),
6868
dsn=sample_env.get_connect_string(),
69+
params=sample_env.get_pool_params(),
6970
min=1,
7071
max=CONCURRENCY,
7172
session_callback=init_session,

python/python-oracledb/batch_errors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2016, 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2016, 2024, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -44,6 +44,7 @@
4444
user=sample_env.get_main_user(),
4545
password=sample_env.get_main_password(),
4646
dsn=sample_env.get_connect_string(),
47+
params=sample_env.get_connect_params(),
4748
)
4849

4950
with connection.cursor() as cursor:

python/python-oracledb/batch_errors_async.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -46,6 +46,7 @@ async def main():
4646
user=sample_env.get_main_user(),
4747
password=sample_env.get_main_password(),
4848
dsn=sample_env.get_connect_string(),
49+
params=sample_env.get_connect_params(),
4950
)
5051

5152
with connection.cursor() as cursor:

python/python-oracledb/bind_insert.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2016, 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2016, 2024, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -39,6 +39,7 @@
3939
user=sample_env.get_main_user(),
4040
password=sample_env.get_main_password(),
4141
dsn=sample_env.get_connect_string(),
42+
params=sample_env.get_connect_params(),
4243
)
4344

4445
# -----------------------------------------------------------------------------

python/python-oracledb/bind_insert_async.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -41,6 +41,7 @@ async def main():
4141
user=sample_env.get_main_user(),
4242
password=sample_env.get_main_password(),
4343
dsn=sample_env.get_connect_string(),
44+
params=sample_env.get_connect_params(),
4445
)
4546

4647
# -------------------------------------------------------------------------

python/python-oracledb/bind_query.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2016, 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2016, 2024, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -44,6 +44,7 @@
4444
user=sample_env.get_main_user(),
4545
password=sample_env.get_main_password(),
4646
dsn=sample_env.get_connect_string(),
47+
params=sample_env.get_connect_params(),
4748
)
4849

4950
# Bind by position with lists

0 commit comments

Comments
 (0)