File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
sdks/python/apache_beam/io Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 9797 from pymongo import DESCENDING
9898 from pymongo import MongoClient
9999 from pymongo import ReplaceOne
100+ from pymongo .driver_info import DriverInfo
100101except ImportError :
101102 objectid = None
102103 json_util = None
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" )
You can’t perform that action at this time.
0 commit comments