mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-09 04:50:37 +00:00
community: Add support for clob datatype in oracle database (#27330)
**Description**: This PR add support of clob/blob data type for oracle document loader, clob/blob can only be read by oracledb package when connection is open, so reformat code to process data before connection closes. **Dependencies**: oracledb package same as before. pip install oracledb Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
parent
8e66822100
commit
15c1ddaf99
@ -100,7 +100,13 @@ class OracleAutonomousDatabaseLoader(BaseLoader):
|
||||
cursor.execute(self.query)
|
||||
columns = [col[0] for col in cursor.description]
|
||||
data = cursor.fetchall()
|
||||
data = [dict(zip(columns, row)) for row in data]
|
||||
data = [
|
||||
{
|
||||
i: (j if not isinstance(j, oracledb.LOB) else j.read())
|
||||
for i, j in zip(columns, row)
|
||||
}
|
||||
for row in data
|
||||
]
|
||||
except oracledb.DatabaseError as e:
|
||||
print("Got error while connecting: " + str(e)) # noqa: T201
|
||||
data = []
|
||||
|
Loading…
Reference in New Issue
Block a user