Skip to content

Commit e7e860e

Browse files
authored
fix logic for mssql db creation (#9)
1 parent b1432db commit e7e860e

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

requirements.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
beautifulsoup4==4.13.4
2-
hf_xet==1.0.3
3-
langchain-community==0.3.21
2+
hf_xet==1.1.2
3+
langchain-community==0.3.24
44
langchain-elasticsearch==0.3.2
5-
langchain-huggingface==0.1.2
5+
langchain-huggingface==0.2.0
66
langchain-postgres==0.0.14
77
langchain-qdrant==0.2.0
8-
langchain-sqlserver==0.1.1
9-
langchain==0.3.23
10-
psycopg[binary]==3.2.6
8+
langchain-sqlserver==0.1.2
9+
langchain==0.3.25
10+
psycopg[binary]==3.2.9
1111
psycopg2-binary==2.9.10
1212
pyodbc==5.2.0
13-
pypdf==5.4.0
13+
pypdf==5.6.0
1414
python-dotenv==1.1.0
15-
qdrant-client==1.13.3
15+
qdrant-client==1.14.2
1616
redis==5.2.1
1717
sentence-transformers==4.1.0
1818
unstructured[md]==0.17.2

vector_db/mssql_provider.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,14 @@ def _ensure_database_exists(self) -> None:
134134
f"IF DB_ID('{database}') IS NULL CREATE DATABASE [{database}]"
135135
)
136136
cursor.close()
137-
except Exception as e:
137+
except pyodbc.ProgrammingError as e:
138+
if "1801" in str(e):
139+
logger.info("Database %s already exists, continuing", database)
140+
return
138141
logger.exception("Failed to ensure database '%s' exists", database)
139-
raise RuntimeError(f"Failed to ensure database '{database}' exists: {e}")
142+
raise RuntimeError(
143+
f"Failed to ensure database '{database}' exists: {e}"
144+
) from e
140145

141146
def add_documents(self, docs: List[Document]) -> None:
142147
"""

0 commit comments

Comments
 (0)