我有下面的配置单元操作符,我必须根据日期添加分区
HiveOperator(task_id='add_partition_{}'.format(state),
hql='alter table my_db.state_wise_records add partition (event_date="{{ ds }}", state="{state}") location "/user/cloudera/state_wise_records/event_date={{ ds }}/state={state}"'.format(state=state),
dag=dag)
然而,这并不是将宏转换为日期,而不是像下面这样
/user/cloudera/state_wise_records/event_date={ds}/state=UP
这里有什么不对劲
不能将带参数的字符串与Jinja模板结合使用。您将不得不拆分为不同的字符串并连接它们。例如:
相关问题 更多 >
编程相关推荐