blob: 2a6f05fa93fac4f08f88b7edc3cb204cbe5f58cc [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>airflow.contrib.operators.bigquery_operator &mdash; Airflow Documentation</title>
<script type="text/javascript" src="../../../../../_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="../../../../../" src="../../../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../../../_static/language_data.js"></script>
<script type="text/javascript" src="../../../../../_static/js/theme.js"></script>
<link rel="stylesheet" href="../../../../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../../../../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../../../../../genindex.html" />
<link rel="search" title="Search" href="../../../../../search.html" />
<link rel="next" title="airflow.contrib.operators.bigquery_table_delete_operator" href="../bigquery_table_delete_operator/index.html" />
<link rel="prev" title="airflow.contrib.operators.bigquery_get_data" href="../bigquery_get_data/index.html" />
<script>
document.addEventListener('DOMContentLoaded', function() {
var el = document.getElementById('changelog');
if (el !== null ) {
// [AIRFLOW-...]
el.innerHTML = el.innerHTML.replace(
/\[(AIRFLOW-[\d]+)\]/g,
`<a href="https://issues.apache.org/jira/browse/$1">[$1]</a>`
);
// (#...)
el.innerHTML = el.innerHTML.replace(
/\(#([\d]+)\)/g,
`<a href="https://github.com/apache/airflow/pull/$1">(#$1)</a>`
);
};
})
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-140539454-1']);
_gaq.push(['_trackPageview']);
</script>
<style>
.example-header {
position: relative;
background: #9AAA7A;
padding: 8px 16px;
margin-bottom: 0;
}
.example-header--with-button {
padding-right: 166px;
}
.example-header:after{
content: '';
display: table;
clear: both;
}
.example-title {
display:block;
padding: 4px;
margin-right: 16px;
color: white;
overflow-x: auto;
}
.example-header-button {
top: 8px;
right: 16px;
position: absolute;
}
.example-header + .highlight-python {
margin-top: 0 !important;
}
.viewcode-button {
display: inline-block;
padding: 8px 16px;
border: 0;
margin: 0;
outline: 0;
border-radius: 2px;
-webkit-box-shadow: 0 3px 5px 0 rgba(0,0,0,.3);
box-shadow: 0 3px 6px 0 rgba(0,0,0,.3);
color: #404040;
background-color: #e7e7e7;
cursor: pointer;
font-size: 16px;
font-weight: 500;
line-height: 1;
text-decoration: none;
text-overflow: ellipsis;
overflow: hidden;
text-transform: uppercase;
-webkit-transition: background-color .2s;
transition: background-color .2s;
vertical-align: middle;
white-space: nowrap;
}
.viewcode-button:visited {
color: #404040;
}
.viewcode-button:hover, .viewcode-button:focus {
color: #404040;
background-color: #d6d6d6;
}
</style>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../../../../../index.html" class="icon icon-home"> Airflow
</a>
<div class="version">
1.10.5
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../../../project.html">Project</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../license.html">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../start.html">Quick Start</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../tutorial.html">Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../howto/index.html">How-to Guides</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../ui.html">UI / Screenshots</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../concepts.html">Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../profiling.html">Data Profiling</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../cli.html">Command Line Interface Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../scheduler.html">Scheduling &amp; Triggers</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../plugins.html">Plugins</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../security.html">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../timezone.html">Time zones</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../api.html">REST API Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../integration.html">Integration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../metrics.html">Metrics</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../kubernetes.html">Kubernetes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../lineage.html">Lineage</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../changelog.html">Changelog</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../faq.html">FAQ</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../macros.html">Macros reference</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../../../index.html">Python API Reference</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="../../../../index.html#operators">Operators</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../../../../index.html#baseoperator">BaseOperator</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../index.html#basesensoroperator">BaseSensorOperator</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="../../../../index.html#operators-packages">Operators packages</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="../../../operators/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.operators</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../sensors/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.sensors</span></code></a></li>
<li class="toctree-l4 current"><a class="reference internal" href="../index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.operators</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../sensors/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.sensors</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../../../index.html#hooks">Hooks</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../index.html#executors">Executors</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../index.html#models">Models</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../index.html#core-and-community-package">Core and community package</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../privacy_notice.html">Privacy Notice</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../../../../index.html">Airflow</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../../../../index.html">Docs</a> &raquo;</li>
<li><a href="../../../../index.html">Python API Reference</a> &raquo;</li>
<li><a href="../index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.operators</span></code></a> &raquo;</li>
<li><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.operators.bigquery_operator</span></code></li>
<li class="wy-breadcrumbs-aside">
<a href="../../../../../_sources/_api/airflow/contrib/operators/bigquery_operator/index.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="module-airflow.contrib.operators.bigquery_operator">
<span id="airflow-contrib-operators-bigquery-operator"></span><h1><a class="reference internal" href="#module-airflow.contrib.operators.bigquery_operator" title="airflow.contrib.operators.bigquery_operator"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.operators.bigquery_operator</span></code></a><a class="headerlink" href="#module-airflow.contrib.operators.bigquery_operator" title="Permalink to this headline"></a></h1>
<p><p>This module contains Google BigQuery operators.</p>
</p>
<div class="section" id="module-contents">
<h2>Module Contents<a class="headerlink" href="#module-contents" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryConsoleLink">
<em class="property">class </em><code class="sig-prename descclassname">airflow.contrib.operators.bigquery_operator.</code><code class="sig-name descname">BigQueryConsoleLink</code><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryConsoleLink"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryConsoleLink" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="../../../models/baseoperator/index.html#airflow.models.baseoperator.BaseOperatorLink" title="airflow.models.baseoperator.BaseOperatorLink"><code class="xref py py-class docutils literal notranslate"><span class="pre">airflow.models.baseoperator.BaseOperatorLink</span></code></a></p>
<p>Helper class for constructing BigQuery link.</p>
<dl class="attribute">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryConsoleLink.name">
<code class="sig-name descname">name</code><em class="property"> = BigQuery Console</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryConsoleLink.name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryConsoleLink.name" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryConsoleLink.get_link">
<code class="sig-name descname">get_link</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">operator</em>, <em class="sig-param">dttm</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryConsoleLink.get_link"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryConsoleLink.get_link" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryOperator">
<em class="property">class </em><code class="sig-prename descclassname">airflow.contrib.operators.bigquery_operator.</code><code class="sig-name descname">BigQueryOperator</code><span class="sig-paren">(</span><em class="sig-param">bql=None</em>, <em class="sig-param">sql=None</em>, <em class="sig-param">destination_dataset_table=None</em>, <em class="sig-param">write_disposition='WRITE_EMPTY'</em>, <em class="sig-param">allow_large_results=False</em>, <em class="sig-param">flatten_results=None</em>, <em class="sig-param">bigquery_conn_id='bigquery_default'</em>, <em class="sig-param">delegate_to=None</em>, <em class="sig-param">udf_config=None</em>, <em class="sig-param">use_legacy_sql=True</em>, <em class="sig-param">maximum_billing_tier=None</em>, <em class="sig-param">maximum_bytes_billed=None</em>, <em class="sig-param">create_disposition='CREATE_IF_NEEDED'</em>, <em class="sig-param">schema_update_options=()</em>, <em class="sig-param">query_params=None</em>, <em class="sig-param">labels=None</em>, <em class="sig-param">priority='INTERACTIVE'</em>, <em class="sig-param">time_partitioning=None</em>, <em class="sig-param">api_resource_configs=None</em>, <em class="sig-param">cluster_fields=None</em>, <em class="sig-param">location=None</em>, <em class="sig-param">encryption_configuration=None</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryOperator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryOperator" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="../../../models/baseoperator/index.html#airflow.models.baseoperator.BaseOperator" title="airflow.models.baseoperator.BaseOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">airflow.models.baseoperator.BaseOperator</span></code></a></p>
<p>Executes BigQuery SQL queries in a specific BigQuery database</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>bql</strong> (<em>Can receive a str representing a sql statement</em><em>,
</em><em>a list of str</em><em> (</em><em>sql statements</em><em>)</em><em>, or </em><em>reference to a template file.
Template reference are recognized by str ending in '.sql'.</em>) – (Deprecated. Use <cite>sql</cite> parameter instead) the sql code to be
executed (templated)</p></li>
<li><p><strong>sql</strong> (<em>Can receive a str representing a sql statement</em><em>,
</em><em>a list of str</em><em> (</em><em>sql statements</em><em>)</em><em>, or </em><em>reference to a template file.
Template reference are recognized by str ending in '.sql'.</em>) – the sql code to be executed (templated)</p></li>
<li><p><strong>destination_dataset_table</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – A dotted
<code class="docutils literal notranslate"><span class="pre">(&lt;project&gt;.|&lt;project&gt;:)&lt;dataset&gt;.&lt;table&gt;</span></code> that, if set, will store the results
of the query. (templated)</p></li>
<li><p><strong>write_disposition</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Specifies the action that occurs if the destination table
already exists. (default: ‘WRITE_EMPTY’)</p></li>
<li><p><strong>create_disposition</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Specifies whether the job is allowed to create new tables.
(default: ‘CREATE_IF_NEEDED’)</p></li>
<li><p><strong>allow_large_results</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) – Whether to allow large results.</p></li>
<li><p><strong>flatten_results</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) – If true and query uses legacy SQL dialect, flattens
all nested and repeated fields in the query results. <code class="docutils literal notranslate"><span class="pre">allow_large_results</span></code>
must be <code class="docutils literal notranslate"><span class="pre">true</span></code> if this is set to <code class="docutils literal notranslate"><span class="pre">false</span></code>. For standard SQL queries, this
flag is ignored and results are never flattened.</p></li>
<li><p><strong>bigquery_conn_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – reference to a specific BigQuery hook.</p></li>
<li><p><strong>delegate_to</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The account to impersonate, if any.
For this to work, the service account making the request must have domain-wide
delegation enabled.</p></li>
<li><p><strong>udf_config</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a>) – The User Defined Function configuration for the query.
See <a class="reference external" href="https://cloud.google.com/bigquery/user-defined-functions">https://cloud.google.com/bigquery/user-defined-functions</a> for details.</p></li>
<li><p><strong>use_legacy_sql</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) – Whether to use legacy SQL (true) or standard SQL (false).</p></li>
<li><p><strong>maximum_billing_tier</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – Positive integer that serves as a multiplier
of the basic price.
Defaults to None, in which case it uses the value set in the project.</p></li>
<li><p><strong>maximum_bytes_billed</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><em>float</em></a>) – Limits the bytes billed for this job.
Queries that will have bytes billed beyond this limit will fail
(without incurring a charge). If unspecified, this will be
set to your project default.</p></li>
<li><p><strong>api_resource_configs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) – a dictionary that contain params
‘configuration’ applied for Google BigQuery Jobs API:
<a class="reference external" href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs">https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs</a>
for example, {‘query’: {‘useQueryCache’: False}}. You could use it
if you need to provide some params that are not supported by BigQueryOperator
like args.</p></li>
<li><p><strong>schema_update_options</strong> (<em>Optional</em><em>[</em><em>Union</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.7)"><em>tuple</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#set" title="(in Python v3.7)"><em>set</em></a><em>]</em><em>]</em>) – Allows the schema of the destination
table to be updated as a side effect of the load job.</p></li>
<li><p><strong>query_params</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a>) – a list of dictionary containing query parameter types and
values, passed to BigQuery. The structure of dictionary should look like
‘queryParameters’ in Google BigQuery Jobs API:
<a class="reference external" href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs">https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs</a>.
For example, [{ ‘name’: ‘corpus’, ‘parameterType’: { ‘type’: ‘STRING’ },
‘parameterValue’: { ‘value’: ‘romeoandjuliet’ } }].</p></li>
<li><p><strong>labels</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) – a dictionary containing labels for the job/query,
passed to BigQuery</p></li>
<li><p><strong>priority</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Specifies a priority for the query.
Possible values include INTERACTIVE and BATCH.
The default value is INTERACTIVE.</p></li>
<li><p><strong>time_partitioning</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) – configure optional time partitioning fields i.e.
partition by field, type and expiration as per API specifications.</p></li>
<li><p><strong>cluster_fields</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a><em>]</em>) – Request that the result of this query be stored sorted
by one or more columns. This is only available in conjunction with
time_partitioning. The order of columns given determines the sort order.</p></li>
<li><p><strong>location</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The geographic location of the job. Required except for
US and EU. See details at
<a class="reference external" href="https://cloud.google.com/bigquery/docs/locations#specifying_your_location">https://cloud.google.com/bigquery/docs/locations#specifying_your_location</a></p></li>
<li><p><strong>encryption_configuration</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) – <p>[Optional] Custom encryption configuration (e.g., Cloud KMS keys).
<strong>Example</strong>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">encryption_configuration</span> <span class="o">=</span> <span class="p">{</span>
<span class="s2">&quot;kmsKeyName&quot;</span><span class="p">:</span> <span class="s2">&quot;projects/testp/locations/us/keyRings/test-kr/cryptoKeys/test-key&quot;</span>
<span class="p">}</span>
</pre></div>
</div>
</p></li>
</ul>
</dd>
</dl>
<dl class="attribute">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryOperator.template_fields">
<code class="sig-name descname">template_fields</code><em class="property"> = ['bql', 'sql', 'destination_dataset_table', 'labels']</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryOperator.template_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryOperator.template_fields" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryOperator.template_ext">
<code class="sig-name descname">template_ext</code><em class="property"> = ['.sql']</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryOperator.template_ext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryOperator.template_ext" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryOperator.ui_color">
<code class="sig-name descname">ui_color</code><em class="property"> = #e4f0e8</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryOperator.ui_color"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryOperator.ui_color" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryOperator.operator_extra_links">
<code class="sig-name descname">operator_extra_links</code><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryOperator.operator_extra_links"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryOperator.operator_extra_links" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryOperator.execute">
<code class="sig-name descname">execute</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">context</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryOperator.execute"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryOperator.execute" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryOperator.on_kill">
<code class="sig-name descname">on_kill</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryOperator.on_kill"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryOperator.on_kill" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyTableOperator">
<em class="property">class </em><code class="sig-prename descclassname">airflow.contrib.operators.bigquery_operator.</code><code class="sig-name descname">BigQueryCreateEmptyTableOperator</code><span class="sig-paren">(</span><em class="sig-param">dataset_id</em>, <em class="sig-param">table_id</em>, <em class="sig-param">project_id=None</em>, <em class="sig-param">schema_fields=None</em>, <em class="sig-param">gcs_schema_object=None</em>, <em class="sig-param">time_partitioning=None</em>, <em class="sig-param">bigquery_conn_id='bigquery_default'</em>, <em class="sig-param">google_cloud_storage_conn_id='google_cloud_default'</em>, <em class="sig-param">delegate_to=None</em>, <em class="sig-param">labels=None</em>, <em class="sig-param">encryption_configuration=None</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryCreateEmptyTableOperator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyTableOperator" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="../../../models/baseoperator/index.html#airflow.models.baseoperator.BaseOperator" title="airflow.models.baseoperator.BaseOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">airflow.models.baseoperator.BaseOperator</span></code></a></p>
<p>Creates a new, empty table in the specified BigQuery dataset,
optionally with schema.</p>
<p>The schema to be used for the BigQuery table may be specified in one of
two ways. You may either directly pass the schema fields in, or you may
point the operator to a Google cloud storage object name. The object in
Google cloud storage must be a JSON file with the schema fields in it.
You can also create a table without schema.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>project_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The project to create the table into. (templated)</p></li>
<li><p><strong>dataset_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The dataset to create the table into. (templated)</p></li>
<li><p><strong>table_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The Name of the table to be created. (templated)</p></li>
<li><p><strong>schema_fields</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a>) – <p>If set, the schema field list as defined here:
<a class="reference external" href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.load.schema">https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.load.schema</a></p>
<p><strong>Example</strong>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">schema_fields</span><span class="o">=</span><span class="p">[{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;emp_name&quot;</span><span class="p">,</span> <span class="s2">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;STRING&quot;</span><span class="p">,</span> <span class="s2">&quot;mode&quot;</span><span class="p">:</span> <span class="s2">&quot;REQUIRED&quot;</span><span class="p">},</span>
<span class="p">{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;salary&quot;</span><span class="p">,</span> <span class="s2">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;INTEGER&quot;</span><span class="p">,</span> <span class="s2">&quot;mode&quot;</span><span class="p">:</span> <span class="s2">&quot;NULLABLE&quot;</span><span class="p">}]</span>
</pre></div>
</div>
</p></li>
<li><p><strong>gcs_schema_object</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Full path to the JSON file containing
schema (templated). For
example: <code class="docutils literal notranslate"><span class="pre">gs://test-bucket/dir1/dir2/employee_schema.json</span></code></p></li>
<li><p><strong>time_partitioning</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) – <p>configure optional time partitioning fields i.e.
partition by field, type and expiration as per API specifications.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference external" href="https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#timePartitioning">https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#timePartitioning</a></p>
</div>
</p></li>
<li><p><strong>bigquery_conn_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Reference to a specific BigQuery hook.</p></li>
<li><p><strong>google_cloud_storage_conn_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Reference to a specific Google
cloud storage hook.</p></li>
<li><p><strong>delegate_to</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The account to impersonate, if any. For this to
work, the service account making the request must have domain-wide
delegation enabled.</p></li>
<li><p><strong>labels</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) – <p>a dictionary containing labels for the table, passed to BigQuery</p>
<p><strong>Example (with schema JSON in GCS)</strong>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">CreateTable</span> <span class="o">=</span> <span class="n">BigQueryCreateEmptyTableOperator</span><span class="p">(</span>
<span class="n">task_id</span><span class="o">=</span><span class="s1">&#39;BigQueryCreateEmptyTableOperator_task&#39;</span><span class="p">,</span>
<span class="n">dataset_id</span><span class="o">=</span><span class="s1">&#39;ODS&#39;</span><span class="p">,</span>
<span class="n">table_id</span><span class="o">=</span><span class="s1">&#39;Employees&#39;</span><span class="p">,</span>
<span class="n">project_id</span><span class="o">=</span><span class="s1">&#39;internal-gcp-project&#39;</span><span class="p">,</span>
<span class="n">gcs_schema_object</span><span class="o">=</span><span class="s1">&#39;gs://schema-bucket/employee_schema.json&#39;</span><span class="p">,</span>
<span class="n">bigquery_conn_id</span><span class="o">=</span><span class="s1">&#39;airflow-service-account&#39;</span><span class="p">,</span>
<span class="n">google_cloud_storage_conn_id</span><span class="o">=</span><span class="s1">&#39;airflow-service-account&#39;</span>
<span class="p">)</span>
</pre></div>
</div>
<p><strong>Corresponding Schema file</strong> (<code class="docutils literal notranslate"><span class="pre">employee_schema.json</span></code>):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span>
<span class="p">{</span>
<span class="s2">&quot;mode&quot;</span><span class="p">:</span> <span class="s2">&quot;NULLABLE&quot;</span><span class="p">,</span>
<span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;emp_name&quot;</span><span class="p">,</span>
<span class="s2">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;STRING&quot;</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="s2">&quot;mode&quot;</span><span class="p">:</span> <span class="s2">&quot;REQUIRED&quot;</span><span class="p">,</span>
<span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;salary&quot;</span><span class="p">,</span>
<span class="s2">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;INTEGER&quot;</span>
<span class="p">}</span>
<span class="p">]</span>
</pre></div>
</div>
<p><strong>Example (with schema in the DAG)</strong>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">CreateTable</span> <span class="o">=</span> <span class="n">BigQueryCreateEmptyTableOperator</span><span class="p">(</span>
<span class="n">task_id</span><span class="o">=</span><span class="s1">&#39;BigQueryCreateEmptyTableOperator_task&#39;</span><span class="p">,</span>
<span class="n">dataset_id</span><span class="o">=</span><span class="s1">&#39;ODS&#39;</span><span class="p">,</span>
<span class="n">table_id</span><span class="o">=</span><span class="s1">&#39;Employees&#39;</span><span class="p">,</span>
<span class="n">project_id</span><span class="o">=</span><span class="s1">&#39;internal-gcp-project&#39;</span><span class="p">,</span>
<span class="n">schema_fields</span><span class="o">=</span><span class="p">[{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;emp_name&quot;</span><span class="p">,</span> <span class="s2">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;STRING&quot;</span><span class="p">,</span> <span class="s2">&quot;mode&quot;</span><span class="p">:</span> <span class="s2">&quot;REQUIRED&quot;</span><span class="p">},</span>
<span class="p">{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;salary&quot;</span><span class="p">,</span> <span class="s2">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;INTEGER&quot;</span><span class="p">,</span> <span class="s2">&quot;mode&quot;</span><span class="p">:</span> <span class="s2">&quot;NULLABLE&quot;</span><span class="p">}],</span>
<span class="n">bigquery_conn_id</span><span class="o">=</span><span class="s1">&#39;airflow-service-account&#39;</span><span class="p">,</span>
<span class="n">google_cloud_storage_conn_id</span><span class="o">=</span><span class="s1">&#39;airflow-service-account&#39;</span>
<span class="p">)</span>
</pre></div>
</div>
</p></li>
<li><p><strong>encryption_configuration</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) – <p>[Optional] Custom encryption configuration (e.g., Cloud KMS keys).
<strong>Example</strong>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">encryption_configuration</span> <span class="o">=</span> <span class="p">{</span>
<span class="s2">&quot;kmsKeyName&quot;</span><span class="p">:</span> <span class="s2">&quot;projects/testp/locations/us/keyRings/test-kr/cryptoKeys/test-key&quot;</span>
<span class="p">}</span>
</pre></div>
</div>
</p></li>
</ul>
</dd>
</dl>
<dl class="attribute">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyTableOperator.template_fields">
<code class="sig-name descname">template_fields</code><em class="property"> = ['dataset_id', 'table_id', 'project_id', 'gcs_schema_object', 'labels']</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryCreateEmptyTableOperator.template_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyTableOperator.template_fields" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyTableOperator.ui_color">
<code class="sig-name descname">ui_color</code><em class="property"> = #f0eee4</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryCreateEmptyTableOperator.ui_color"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyTableOperator.ui_color" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyTableOperator.execute">
<code class="sig-name descname">execute</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">context</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryCreateEmptyTableOperator.execute"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyTableOperator.execute" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryCreateExternalTableOperator">
<em class="property">class </em><code class="sig-prename descclassname">airflow.contrib.operators.bigquery_operator.</code><code class="sig-name descname">BigQueryCreateExternalTableOperator</code><span class="sig-paren">(</span><em class="sig-param">bucket</em>, <em class="sig-param">source_objects</em>, <em class="sig-param">destination_project_dataset_table</em>, <em class="sig-param">schema_fields=None</em>, <em class="sig-param">schema_object=None</em>, <em class="sig-param">source_format='CSV'</em>, <em class="sig-param">compression='NONE'</em>, <em class="sig-param">skip_leading_rows=0</em>, <em class="sig-param">field_delimiter='</em>, <em class="sig-param">'</em>, <em class="sig-param">max_bad_records=0</em>, <em class="sig-param">quote_character=None</em>, <em class="sig-param">allow_quoted_newlines=False</em>, <em class="sig-param">allow_jagged_rows=False</em>, <em class="sig-param">bigquery_conn_id='bigquery_default'</em>, <em class="sig-param">google_cloud_storage_conn_id='google_cloud_default'</em>, <em class="sig-param">delegate_to=None</em>, <em class="sig-param">src_fmt_configs=None</em>, <em class="sig-param">labels=None</em>, <em class="sig-param">encryption_configuration=None</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryCreateExternalTableOperator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryCreateExternalTableOperator" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="../../../models/baseoperator/index.html#airflow.models.baseoperator.BaseOperator" title="airflow.models.baseoperator.BaseOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">airflow.models.baseoperator.BaseOperator</span></code></a></p>
<p>Creates a new external table in the dataset with the data in Google Cloud
Storage.</p>
<p>The schema to be used for the BigQuery table may be specified in one of
two ways. You may either directly pass the schema fields in, or you may
point the operator to a Google cloud storage object name. The object in
Google cloud storage must be a JSON file with the schema fields in it.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>bucket</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The bucket to point the external table to. (templated)</p></li>
<li><p><strong>source_objects</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a>) – List of Google cloud storage URIs to point
table to. (templated)
If source_format is ‘DATASTORE_BACKUP’, the list must only contain a single URI.</p></li>
<li><p><strong>destination_project_dataset_table</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The dotted <code class="docutils literal notranslate"><span class="pre">(&lt;project&gt;.)&lt;dataset&gt;.&lt;table&gt;</span></code>
BigQuery table to load data into (templated). If <code class="docutils literal notranslate"><span class="pre">&lt;project&gt;</span></code> is not included,
project will be the project defined in the connection json.</p></li>
<li><p><strong>schema_fields</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a>) – <p>If set, the schema field list as defined here:
<a class="reference external" href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.load.schema">https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.load.schema</a></p>
<p><strong>Example</strong>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">schema_fields</span><span class="o">=</span><span class="p">[{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;emp_name&quot;</span><span class="p">,</span> <span class="s2">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;STRING&quot;</span><span class="p">,</span> <span class="s2">&quot;mode&quot;</span><span class="p">:</span> <span class="s2">&quot;REQUIRED&quot;</span><span class="p">},</span>
<span class="p">{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;salary&quot;</span><span class="p">,</span> <span class="s2">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;INTEGER&quot;</span><span class="p">,</span> <span class="s2">&quot;mode&quot;</span><span class="p">:</span> <span class="s2">&quot;NULLABLE&quot;</span><span class="p">}]</span>
</pre></div>
</div>
<p>Should not be set when source_format is ‘DATASTORE_BACKUP’.</p>
</p></li>
<li><p><strong>schema_object</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – If set, a GCS object path pointing to a .json file that
contains the schema for the table. (templated)</p></li>
<li><p><strong>source_format</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – File format of the data.</p></li>
<li><p><strong>compression</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – [Optional] The compression type of the data source.
Possible values include GZIP and NONE.
The default value is NONE.
This setting is ignored for Google Cloud Bigtable,
Google Cloud Datastore backups and Avro formats.</p></li>
<li><p><strong>skip_leading_rows</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – Number of rows to skip when loading from a CSV.</p></li>
<li><p><strong>field_delimiter</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The delimiter to use for the CSV.</p></li>
<li><p><strong>max_bad_records</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – The maximum number of bad records that BigQuery can
ignore when running the job.</p></li>
<li><p><strong>quote_character</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The value that is used to quote data sections in a CSV file.</p></li>
<li><p><strong>allow_quoted_newlines</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) – Whether to allow quoted newlines (true) or not (false).</p></li>
<li><p><strong>allow_jagged_rows</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) – Accept rows that are missing trailing optional columns.
The missing values are treated as nulls. If false, records with missing trailing
columns are treated as bad records, and if there are too many bad records, an
invalid error is returned in the job result. Only applicable to CSV, ignored
for other formats.</p></li>
<li><p><strong>bigquery_conn_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Reference to a specific BigQuery hook.</p></li>
<li><p><strong>google_cloud_storage_conn_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Reference to a specific Google
cloud storage hook.</p></li>
<li><p><strong>delegate_to</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The account to impersonate, if any. For this to
work, the service account making the request must have domain-wide
delegation enabled.</p></li>
<li><p><strong>src_fmt_configs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) – configure optional fields specific to the source format</p></li>
<li><p><strong>labels</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) – a dictionary containing labels for the table, passed to BigQuery</p></li>
<li><p><strong>encryption_configuration</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) – <p>[Optional] Custom encryption configuration (e.g., Cloud KMS keys).
<strong>Example</strong>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">encryption_configuration</span> <span class="o">=</span> <span class="p">{</span>
<span class="s2">&quot;kmsKeyName&quot;</span><span class="p">:</span> <span class="s2">&quot;projects/testp/locations/us/keyRings/test-kr/cryptoKeys/test-key&quot;</span>
<span class="p">}</span>
</pre></div>
</div>
</p></li>
</ul>
</dd>
</dl>
<dl class="attribute">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryCreateExternalTableOperator.template_fields">
<code class="sig-name descname">template_fields</code><em class="property"> = ['bucket', 'source_objects', 'schema_object', 'destination_project_dataset_table', 'labels']</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryCreateExternalTableOperator.template_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryCreateExternalTableOperator.template_fields" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryCreateExternalTableOperator.ui_color">
<code class="sig-name descname">ui_color</code><em class="property"> = #f0eee4</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryCreateExternalTableOperator.ui_color"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryCreateExternalTableOperator.ui_color" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryCreateExternalTableOperator.execute">
<code class="sig-name descname">execute</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">context</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryCreateExternalTableOperator.execute"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryCreateExternalTableOperator.execute" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryDeleteDatasetOperator">
<em class="property">class </em><code class="sig-prename descclassname">airflow.contrib.operators.bigquery_operator.</code><code class="sig-name descname">BigQueryDeleteDatasetOperator</code><span class="sig-paren">(</span><em class="sig-param">dataset_id</em>, <em class="sig-param">project_id=None</em>, <em class="sig-param">bigquery_conn_id='bigquery_default'</em>, <em class="sig-param">delegate_to=None</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryDeleteDatasetOperator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryDeleteDatasetOperator" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="../../../models/baseoperator/index.html#airflow.models.baseoperator.BaseOperator" title="airflow.models.baseoperator.BaseOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">airflow.models.baseoperator.BaseOperator</span></code></a></p>
<p>This operator deletes an existing dataset from your Project in Big query.
<a class="reference external" href="https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/delete">https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/delete</a></p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>project_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The project id of the dataset.</p></li>
<li><p><strong>dataset_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The dataset to be deleted.</p></li>
</ul>
</dd>
</dl>
<p><strong>Example</strong>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">delete_temp_data</span> <span class="o">=</span> <span class="n">BigQueryDeleteDatasetOperator</span><span class="p">(</span><span class="n">dataset_id</span> <span class="o">=</span> <span class="s1">&#39;temp-dataset&#39;</span><span class="p">,</span>
<span class="n">project_id</span> <span class="o">=</span> <span class="s1">&#39;temp-project&#39;</span><span class="p">,</span>
<span class="n">bigquery_conn_id</span><span class="o">=</span><span class="s1">&#39;_my_gcp_conn_&#39;</span><span class="p">,</span>
<span class="n">task_id</span><span class="o">=</span><span class="s1">&#39;Deletetemp&#39;</span><span class="p">,</span>
<span class="n">dag</span><span class="o">=</span><span class="n">dag</span><span class="p">)</span>
</pre></div>
</div>
<dl class="attribute">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryDeleteDatasetOperator.template_fields">
<code class="sig-name descname">template_fields</code><em class="property"> = ['dataset_id', 'project_id']</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryDeleteDatasetOperator.template_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryDeleteDatasetOperator.template_fields" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryDeleteDatasetOperator.ui_color">
<code class="sig-name descname">ui_color</code><em class="property"> = #f00004</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryDeleteDatasetOperator.ui_color"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryDeleteDatasetOperator.ui_color" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryDeleteDatasetOperator.execute">
<code class="sig-name descname">execute</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">context</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryDeleteDatasetOperator.execute"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryDeleteDatasetOperator.execute" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyDatasetOperator">
<em class="property">class </em><code class="sig-prename descclassname">airflow.contrib.operators.bigquery_operator.</code><code class="sig-name descname">BigQueryCreateEmptyDatasetOperator</code><span class="sig-paren">(</span><em class="sig-param">dataset_id</em>, <em class="sig-param">project_id=None</em>, <em class="sig-param">dataset_reference=None</em>, <em class="sig-param">bigquery_conn_id='bigquery_default'</em>, <em class="sig-param">delegate_to=None</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryCreateEmptyDatasetOperator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyDatasetOperator" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="../../../models/baseoperator/index.html#airflow.models.baseoperator.BaseOperator" title="airflow.models.baseoperator.BaseOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">airflow.models.baseoperator.BaseOperator</span></code></a></p>
<p>This operator is used to create new dataset for your Project in Big query.
<a class="reference external" href="https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#resource">https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#resource</a></p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>project_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The name of the project where we want to create the dataset.
Don’t need to provide, if projectId in dataset_reference.</p></li>
<li><p><strong>dataset_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The id of dataset. Don’t need to provide,
if datasetId in dataset_reference.</p></li>
<li><p><strong>dataset_reference</strong> – Dataset reference that could be provided with request body.
More info:
<a class="reference external" href="https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#resource">https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#resource</a></p></li>
</ul>
</dd>
</dl>
<dl class="attribute">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyDatasetOperator.template_fields">
<code class="sig-name descname">template_fields</code><em class="property"> = ['dataset_id', 'project_id']</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryCreateEmptyDatasetOperator.template_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyDatasetOperator.template_fields" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyDatasetOperator.ui_color">
<code class="sig-name descname">ui_color</code><em class="property"> = #f0eee4</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryCreateEmptyDatasetOperator.ui_color"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyDatasetOperator.ui_color" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyDatasetOperator.execute">
<code class="sig-name descname">execute</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">context</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/bigquery_operator.html#BigQueryCreateEmptyDatasetOperator.execute"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyDatasetOperator.execute" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="../bigquery_table_delete_operator/index.html" class="btn btn-neutral float-right" title="airflow.contrib.operators.bigquery_table_delete_operator" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="../bigquery_get_data/index.html" class="btn btn-neutral float-left" title="airflow.contrib.operators.bigquery_get_data" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
<div class="footer">This page uses <a href="https://analytics.google.com/">
Google Analytics</a> to collect statistics. You can disable it by blocking
the JavaScript coming from www.google-analytics.com. Check our
<a href="../../../../../privacy_notice.html">Privacy Policy</a>
for more details.
<script type="text/javascript">
(function() {
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ?
'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
var nodes = document.documentElement.childNodes;
var i = -1;
var node;
do {
i++;
node = nodes[i]
} while(node.nodeType !== Node.ELEMENT_NODE);
node.appendChild(ga);
})();
</script>
</div>
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>