- Le plus récent
- Le plus de votes
- La plupart des commentaires
Could you please share the error you are getting ?
It seems like it's just a problem on your code:
args = getResolvedOptions(sys.argv, ['collection']) args = getResolvedOptions(sys.argv, ['mongodatabase']) args = getResolvedOptions(sys.argv, ['mongo_host']) args = getResolvedOptions(sys.argv, ['password']) args = getResolvedOptions(sys.argv, ['s3_bucket']) args = getResolvedOptions(sys.argv, ['username'])
When you do this you are always overwriting your args variable, so you will only keep the last value (username).
You should do:
args = getResolvedOptions( sys.argv, ['collection', 'mongodatabase', 'mongo_host', 'password', 's3_bucket', 'username'] )
To access these parameters all you have to do is call args[<keyname>] like username = args['username'].
Check here for Glue documentation about getResolvedOptions.
Edit: to access this parameter you must call args['username']. 'username' itself is just a string.
# Set the MongoDB connection options mongo_uri = f"mongodb://{args['username']}:{args['password']}@{args['mongo_host']}:27017/{args['mongodatabase']}.{args['collection']}" mongo_read_config = { "uri": mongo_uri, "spark.mongodb.input.uri": mongo_uri }
@Arthur Lopes
I am getting below error
An error occurred while calling o92.load. Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='username', source=''mongo_db'', password=<hidden>, mechanismProperties=<hidden>}
You are passing literal strings to you code not the value of your parameters, check the edit on my answer.
Contenus pertinents
- demandé il y a un an
- demandé il y a 2 mois
- demandé il y a 6 mois
- AWS OFFICIELA mis à jour il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 3 ans
@ArthurLopes I am getting below error
An error occurred while calling o92.load. Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='username', source=''mongo_db'', password=<hidden>, mechanismProperties=<hidden>}
Even i change the code like above getting same error.