Skip to content

Commit 92b96e7

Browse files
author
deec
committed
updates to README.md and connx_server.py including tests.
1 parent c2c46d2 commit 92b96e7

File tree

5 files changed

+20
-21
lines changed

5 files changed

+20
-21
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
CONNX_DSN=your_dsn_name
33
CONNX_USER=your_username
44
CONNX_PASS=your_password
5-
CONNX_ALLOW_WRITES=false
5+
CONNX_TIMEOUT=30

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,17 +224,17 @@ Below are examples of how MCP-compatible clients (such as Claude Desktop or othe
224224

225225
CONNX Database Server Tools:
226226

227-
query_connx - Query data from CONNX-connected databases using SQL (SELECT-only queries)
228-
update_connx - Perform update operations (requires CONNX_ALLOW_WRITES=true)
229-
count_customers - Get total number of customers
230-
customers_by_state - Get customer distribution by state
231-
customer_cities - Get customer cities information
232-
customers_missing_phone - Find customers without phone numbers
233-
get_customer - Retrieve a specific customer by ID
234-
find_customers - Search for customers by state and optional city
235-
describe_entities - Describe known business entities and their data sources
236-
count_entities - Count rows for business entities (customers, clients, etc.)
237-
---
227+
* query_connx - Query data from CONNX-connected databases using SQL (SELECT-only queries)
228+
* update_connx - Perform update operations (requires CONNX_ALLOW_WRITES=true)
229+
* count_customers - Get total number of customers
230+
* customers_by_state - Get customer distribution by state
231+
* customer_cities - Get customer cities information
232+
* customers_missing_phone - Find customers without phone numbers
233+
* get_customer - Retrieve a specific customer by ID
234+
* find_customers - Search for customers by state and optional city
235+
* describe_entities - Describe known business entities and their data sources
236+
* count_entities - Count rows for business entities (customers, clients, etc.)
237+
* ---
238238

239239
## Testing
240240
This project uses pytest for unit testing. Tests mock database interactions to run without a real CONNX setup.

connx_server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ def _is_select_only(sql: str) -> bool:
100100
def get_connx_connection():
101101
"""Establish a connection to CONNX via pyodbc."""
102102
_assert_config()
103+
104+
timeout = int(os.getenv("CONNX_TIMEOUT", "30"))
103105
conn_str = f"DSN={CONNX_DSN};UID={CONNX_USER};PWD={CONNX_PASS}"
104106
try:
105-
conn = pyodbc.connect(conn_str)
107+
conn = pyodbc.connect(conn_str, timeout=timeout)
106108
logger.info("Successfully connected to CONNX")
107109
return conn
108110
except pyodbc.Error as e:
@@ -122,6 +124,7 @@ def execute_query(query: str, params: Optional[List[Any]] = None) -> List[Dict[s
122124
fp = _sql_fingerprint(query)
123125
try:
124126
cursor = conn.cursor()
127+
# cursor.timeout = int(os.getenv("CONNX_TIMEOUT", "30"))
125128
cursor.execute(query, params or [])
126129
if cursor.description is None:
127130
# A SELECT should provide a description; if not, treat as an error.

requirements-dev.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pytest
2-
pytest-mock
3-
pytest-asyncio
4-
pytest-cov
1+
pytest-mock==3.15.1
2+
pytest-asyncio==1.3.0
3+
pytest==9.0.2
4+
pytest-cov==7.0.0

requirements.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
pytest-mock==3.15.1
2-
pytest-asyncio==1.3.0
3-
pytest==9.0.2
4-
pytest-cov==7.0.0
51
mcp==1.24.0
62
pyodbc==5.3.0
73
python-dotenv==1.2.1

0 commit comments

Comments
 (0)