简体   繁体   English

将动态参数传递给 AWS Glue

[英]Pass Dynamic Parameters to AWS Glue

I am trying to pass dynamic parameters to a glue job.我正在尝试将动态参数传递给粘合作业。 I followed this question: AWS Glue Job Input Parameters我关注了这个问题: AWS Glue 作业输入参数

And configured my parameters like so:并像这样配置我的参数:

在此处输入图像描述

I'm triggering the glue job with boto3 with the following code:我使用以下代码使用 boto3 触发粘合作业:

event = {
    '--ncoa': "True", 
    '--files': 'file.csv', 
    '--group_file': '3e93475d45b4ebecc9a09533ce57b1e7.csv', 
    '--client_slug': 'test', 
    '--slm_id': '12345'
}

glueClient.start_job_run(JobName='TriggerNCOA', Arguments=event)

and when I run this glue code:当我运行这个胶水代码时:

args = getResolvedOptions(sys.argv, ['NCOA','Files','GroupFile','ClientSlug', 'SLMID'])

v_list=[{"ncoa":args['NCOA'],"files":args['Files'],"group_file":args['GroupFile'], "client_slug":args['ClientSlug'], "slm_id":args['SLMID']}]

print(v_list)

It just gives me 'a' for every value, not the values of the original event that I passed in from boto3.它只是给我每个值的“a”,而不是我从 boto3 传入的原始事件的值。 how do I fix that?我该如何解决? Seems like im missing something very slight, but ive looked around and haven't found anything conclusive.似乎我错过了一些非常轻微的东西,但我环顾四周并没有发现任何结论性的东西。

You are using CamelCase and Capital letters into Glue Job Parameters, but you are using small letters in python code to override the Parameters.您在胶水作业参数中使用CamelCase大写字母,但在 python 代码中使用小写字母来覆盖参数。

Ex.前任。

The key of the job parameter in Glue is --ClientSlug but the key for Argument set in python code is --client_slug Glue 中作业参数的键是--ClientSlug ,但python 代码中设置的Argument 的键是--client_slug

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM