Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose service names available in tnsnames.ora #313

Closed
mac-vtl opened this issue Mar 20, 2024 · 5 comments
Closed

Expose service names available in tnsnames.ora #313

mac-vtl opened this issue Mar 20, 2024 · 5 comments
Labels
enhancement New feature or request patch available

Comments

@mac-vtl
Copy link

mac-vtl commented Mar 20, 2024

  1. Describe your new request in detail

python-oracledb internally parses the content of the tnsnames.ora file here but does not provide or expose a way to list the available service names parsed.

We have use cases where we need to switch between database services. It would be logical to propose the list of available services from the list of services parsed by python-oracledb.

Something like below or similar would work:

from oracledb.connect_params import ConnectParams
params = ConnectParamsImpl()
service_names = params.available_service_names()
# do something with service_names
print(service_names)

Is that something feasible? What are your thoughts?

  1. Give supporting information about tools and operating systems. Give relevant product version numbers
import oracledb
import sys
import platform

print("oracledb.__version__:", oracledb.__version__)
print("platform.platform:", platform.platform())
print("sys.maxsize > 2**32:", sys.maxsize > 2**32)
print("platform.python_version:", platform.python_version())
oracledb.__version__: 2.1.0
platform.platform: Windows-10-10.0.19044-SP0
sys.maxsize > 2**32: True
platform.python_version: 3.11.5
@mac-vtl mac-vtl added the enhancement New feature or request label Mar 20, 2024
@anthony-tuininga
Copy link
Member

Yes, that would be possible and shouldn't be too much effort, either.

@anthony-tuininga
Copy link
Member

I have added the function get_network_service_names() which does what you request. If you are able to build from source you can verify that it works for you, too.

@mac-vtl
Copy link
Author

mac-vtl commented Mar 26, 2024

not currently setup to build from source but will try to get setup and provide feedback asap. thanks for the quick turnaround.

@mac-vtl
Copy link
Author

mac-vtl commented Mar 27, 2024

I can confirm it works as expected. tyvm.

@anthony-tuininga
Copy link
Member

This was included in version 2.2.0 which was just released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request patch available
Projects
None yet
Development

No branches or pull requests

2 participants