Skip to content

Commit 7564e9e

Browse files
committed
Revert apache#36949
1 parent bb8373f commit 7564e9e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sdks/python/apache_beam/io/mongodbio.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
from pymongo import DESCENDING
9898
from pymongo import MongoClient
9999
from pymongo import ReplaceOne
100+
from pymongo.driver_info import DriverInfo
100101
except ImportError:
101102
objectid = None
102103
json_util = None
@@ -105,6 +106,7 @@
105106
DESCENDING = -1
106107
MongoClient = None
107108
ReplaceOne = None
109+
DriverInfo = None
108110
_LOGGER.warning("Could not find a compatible bson package.")
109111

110112
__all__ = ["ReadFromMongoDB", "WriteToMongoDB"]
@@ -263,6 +265,12 @@ def __init__(
263265
self.spec = extra_client_params
264266
self.bucket_auto = bucket_auto
265267

268+
if "driver" not in self.spec:
269+
self.spec["driver"] = DriverInfo(
270+
name="Apache Beam",
271+
version=beam.__version__,
272+
)
273+
266274
def estimate_size(self):
267275
with MongoClient(self.uri, **self.spec) as client:
268276
return client[self.db].command("collstats", self.coll).get("size")

0 commit comments

Comments
 (0)