def test_hiveconf_jinja_translate(self): hql = "SELECT ${num_col} FROM ${hiveconf:table};" op = HiveOperator( hiveconf_jinja_translate=True, task_id='dry_run_basic_hql', hql=hql, dag=self.dag) op.prepare_template() self.assertEqual(op.hql, "SELECT {{ num_col }} FROM {{ table }};")
def test_hiveconf(self): hql = "SELECT * FROM ${hiveconf:table} PARTITION (${hiveconf:day});" op = HiveOperator( hiveconfs={'table': 'static_babynames', 'day': '{{ ds }}'}, task_id='dry_run_basic_hql', hql=hql, dag=self.dag) op.prepare_template() self.assertEqual( op.hql, "SELECT * FROM ${hiveconf:table} PARTITION (${hiveconf:day});")