Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for Oracle thick mode by allowing a new environment variable (THICK_MODE) to dictate whether to use a synchronous connection (thick mode) or an asynchronous connection (thin mode) to the Oracle database. Key changes include:
- Introducing a new environment variable (THICK_MODE) in main.py and passing the flag to the DatabaseContext.
- Modifying DatabaseConnector to initialize the Oracle Client in thick mode and to choose between synchronous and asynchronous connection and cursor execution.
- Refactoring various database operations to use helper methods that dispatch calls based on the mode.
Reviewed Changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| main.py | Added a THICK_MODE environment variable and updated context creation |
| db_context/schema/manager.py | Refactored schema retrieval to directly call get_effective_schema |
| db_context/database.py | Updated connection initialization, query execution, and connection closing |
| db_context/init.py | Propagated the new use_thick_mode parameter to the DatabaseConnector |
Files not reviewed (2)
- Dockerfile: Language not supported
- test/db/.env.example: Language not supported
Comments suppressed due to low confidence (1)
db_context/database.py:329
- In thick mode, the CLOB object is likely synchronous and may not support being awaited. Consider differentiating the CLOB read operation based on the connection mode (e.g. using 'clob.read()' for thick mode and 'await clob.read()' for thin mode).
clob = result[0][0]
Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User can set environment variable THICK_MODE=True and allow for the MCP Server to connect to Oracle in thick mode.
Enhancements to Dockerfile:
Database context and connector updates:
DatabaseContextclass to include ause_thick_modeparameter and pass it to theDatabaseConnector.DatabaseConnectorclass to initialize Oracle Client in thick mode if specified and handle fallback to thin mode if initialization fails.Refactoring of database operations:
get_connectionmethod to use synchronous connection for thick mode and asynchronous connection for thin mode._execute_cursor,_execute_cursor_no_fetch, and_committo handle synchronous and asynchronous cursor operations and commits based on the mode.get_database_info,get_all_table_names,load_table_details,get_pl_sql_objects,get_object_source,get_table_constraints,get_table_indexes) to use the new helper methods for executing database operations. [1] [2] [3] [4] [5] [6] [7] [8] [9]