mirror of
https://github.com/Unstructured-IO/unstructured.git
synced 2025-11-03 11:34:07 +00:00
enhancement: add mongodb driver (#2445)
### Summary Adds a driver with `unstructured` version information to the MongoDB driver. ### Testing, Good to go as long as the MongoDB ingest test run successfully.
This commit is contained in:
parent
44cb2ce645
commit
a155e7a43b
@ -1,7 +1,10 @@
|
||||
## 0.12.3-dev2
|
||||
## 0.12.3-dev3
|
||||
|
||||
### Enhancements
|
||||
|
||||
* **Driver for MongoDB connector.** Adds a driver with `unstructured` version information to the
|
||||
MongoDB connector.
|
||||
|
||||
### Features
|
||||
|
||||
* **Add Databricks Volumes destination connector** Databricks Volumes connector added to ingest CLI. Users may now use `unstructured-ingest` to write partitioned data to a Databricks Volumes storage service.
|
||||
|
||||
@ -1 +1 @@
|
||||
__version__ = "0.12.3-dev2" # pragma: no cover
|
||||
__version__ = "0.12.3-dev3" # pragma: no cover
|
||||
|
||||
@ -5,6 +5,7 @@ from pathlib import Path
|
||||
|
||||
from dataclasses_json.core import Json
|
||||
|
||||
from unstructured.__version__ import __version__ as unstructured_version
|
||||
from unstructured.ingest.enhanced_dataclass.core import _asdict
|
||||
from unstructured.ingest.error import DestinationConnectionError, SourceConnectionError, WriteError
|
||||
from unstructured.ingest.interfaces import (
|
||||
@ -93,10 +94,15 @@ class SimpleMongoDBConfig(BaseConnectorConfig):
|
||||
@requires_dependencies(["pymongo"], extras="mongodb")
|
||||
def generate_client(self) -> "MongoClient":
|
||||
from pymongo import MongoClient
|
||||
from pymongo.driver_info import DriverInfo
|
||||
from pymongo.server_api import ServerApi
|
||||
|
||||
if self.uri:
|
||||
return MongoClient(self.uri, server_api=ServerApi(version=SERVER_API_VERSION))
|
||||
return MongoClient(
|
||||
self.uri,
|
||||
server_api=ServerApi(version=SERVER_API_VERSION),
|
||||
driver=DriverInfo(name="unstructured", version=unstructured_version),
|
||||
)
|
||||
else:
|
||||
return MongoClient(
|
||||
host=self.host,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user