- Newest
- Most votes
- Most comments
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.
Relevant content
- asked 8 months ago
- asked 8 months ago
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
@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.