Steve Nyemba vor 3 Jahren
Ursprung
Commit
db1496dd38
2 geänderte Dateien mit 6 neuen und 3 gelöschten Zeilen
  1. 2 2
      transport/__init__.py
  2. 4 1
      transport/mongo.py

+ 2 - 2
transport/__init__.py

@@ -151,7 +151,7 @@ def instance(**_args):
 		try:
 			
 			host = ''
-			if provider not in ['bigquery','mongodb','couchdb','sqlite','console','etl','file','rabbitmq'] :
+			if provider not in ['bigquery','mongodb','mongo','couchdb','sqlite','console','etl','file','rabbitmq'] :
 				#
 				# In these cases we are assuming RDBMS and thus would exclude NoSQL and BigQuery
 				username = args['username'] if 'username' in args else ''
@@ -169,7 +169,7 @@ def instance(**_args):
 				account = ''
 				host = ''
 				database = args['path'] if 'path' in args else args['database']
-			if provider not in ['mongodb','couchdb','bigquery','console','etl','file','rabbitmq'] :
+			if provider not in ['mongodb','mongo','couchdb','bigquery','console','etl','file','rabbitmq'] :
 				uri = ''.join([provider,"://",account,host,'/',database])
 				
 				e = sqlalchemy.create_engine (uri,future=True)

+ 4 - 1
transport/mongo.py

@@ -38,7 +38,7 @@ class Mongo :
         host = ":".join([host,port]) #-- Formatting host information here
         self.uid    = args['doc'] if 'doc' in args else None  #-- document identifier
         self.dbname = args['dbname'] if 'dbname' in args else args['db']
-        
+        authMechanism= 'SCRAM-SHA-256' if 'mechanism' not in args else args['mechanism']
         self._lock = False if 'lock' not in args else args['lock']
 
         username = password = None
@@ -49,6 +49,9 @@ class Mongo :
             _info = json.loads((open(args['auth_file'])).read())
             username = _info['username']
             password = _info['password']
+            if 'mechanism' in _info:
+                authMechanism = _info['mechanism']
+        
         authSource=(args['authSource'] if 'authSource' in args else self.dbname)
         
         if username and password :