Example #1
0
 def test_hiveconf_jinja_translate(self):
     hql = "SELECT ${num_col} FROM ${hiveconf:table};"
     op = MockHiveOperator(
         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 }};")
Example #2
0
 def test_hiveconf(self):
     hql = "SELECT * FROM ${hiveconf:table} PARTITION (${hiveconf:day});"
     op = MockHiveOperator(
         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});")