/** elasticlunr - http://weixsong.github.io * Copyright (C) 2017 Oliver Nightingale * Copyright (C) 2017 Wei Song * MIT Licensed */!function(){functione(e){if(null===e||"object"!=typeofe)returne;vart=e.constructor();for(varnine)e.hasOwnProperty(n)&&(t[n]=e[n]);returnt}vart=function(e){varn=newt.Index;returnn.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.9.5",lunr=t,t.utils={},t.utils.warn=function(e){returnfunction(t){e.console&&console.warn&&console.warn(t)}}(this),t.utils.toString=function(e){returnvoid0===e||null===e?"":e.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){vare=Array.prototype.slice.call(arguments),t=e.pop(),n=e;if("function"!=typeoft)thrownewTypeError("last argument must be a function");n.forEach(function(e){this.hasHandler(e)||(this.events[e]=[]),this.events[e].push(t)},this)},t.EventEmitter.prototype.removeListener=function(e,t){if(this.hasHandler(e)){varn=this.events[e].indexOf(t);-1!==n&&(this.events[e].splice(n,1),0==this.events[e].length&&deletethis.events[e])}},t.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){vart=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void0,t)},this)}},t.EventEmitter.prototype.hasHandler=function(e){returneinthis.events},t.tokenizer=function(e){if(!arguments.length||null===e||void0===e)return[];if(Array.isArray(e)){varn=e.filter(function(e){returnnull===e||void0===e?!1:!0});n=n.map(function(e){returnt.utils.toString(e).toLowerCase()});vari=[];returnn.forEach(function(e){varn=e.split(t.tokenizer.seperator);i=i.concat(n)},this),i}returne.toString().trim().toLowerCase().split(t.tokenizer.seperator)},t.tokenizer.defaultSeperator=/[\s\-]+/,t.tokenizer.seperator=t.tokenizer.defaultSeperator,t.tokenizer.setSeperator=function(e){null!==e&&void0!==e&&"object"==typeofe&&(t.tokenizer.seperator=e)},t.tokenizer.resetSeperator=function(){t.tokenizer.seperator=t.tokenizer.defaultSeperator},t.tokenizer.getSeperator=function(){returnt.tokenizer.seperator},t.Pipeline=function(){this._queue=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){nint.Pipeline.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[n]=e},t.Pipeline.getRegisteredFunction=function(e){returneint.Pipeline.registeredFunctions!=!0?null:t.Pipeline.registeredFunctions[e]},t.Pipeline.warnIfFunctionNotRegistered=function(e){varn=e.label&&e.labelinthis.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){varn=newt.Pipeline;returne.forEach(function(e){vari=t.Pipeline.getRegisteredFunction(e);if(!i)thrownewError("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){vare=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._queue.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);vari=this._queue.indexOf(e);if(-1===i)thrownewError("Cannot find existingFn");this._queue.splice(i+1,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);vari=this._queue.indexOf(e);if(-1===i)thrownewError("Cannot find existingFn");this._queue.splice(i,0,n)},t.Pipeline.prototype.remove=function(e){vart=this._queue.indexOf(e);-1!==t&&this._queue.splice(t,1)},t.Pipeline.prototype.run=function(e){for(vart=[],n=e.length,i=this._queue.length,o=0;n>o;o++){for(varr=e[o],s=0;i>s&&(r=this._queue[s](r,o,e),void0!==r&&null!==r);s++);void0!==r&&null!==r&&t.push(r)}returnt},t.Pipeline.prototype.reset=function(){this._queue=[]},t.Pipeline.prototype.get=function(){returnthis._queue},t.Pipeline.prototype.toJSON=function(){returnthis._queue.map(function(e){returnt.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=newt
/** pdoc search index */constdocs={"version":"0.9.5","fields":["qualname","fullname","annotation","default_value","signature","bases","doc"],"ref":"fullname","documentStore":{"docs":{"sqlglot":{"fullname":"sqlglot","modulename":"sqlglot","kind":"module","doc":"<p><img src=\"sqlglot.svg\" alt=\"SQLGlot logo\" /></p>\n\n<p>SQLGlot is a no-dependency SQL parser, transpiler, optimizer, and engine. It can be used to format SQL or translate between <a href=\"https://github.com/tobymao/sqlglot/blob/main/sqlglot/dialects/__init__.py\">19 different dialects</a> like <a href=\"https://duckdb.org/\">DuckDB</a>, <a href=\"https://prestodb.io/\">Presto</a>, <a href=\"https://spark.apache.org/\">Spark</a>, <a href=\"https://www.snowflake.com/en/\">Snowflake</a>, and <a href=\"https://cloud.google.com/bigquery/\">BigQuery</a>. It aims to read a wide variety of SQL inputs and output syntactically correct SQL in the targeted dialects.</p>\n\n<p>It is a very comprehensive generic SQL parser with a robust <a href=\"https://github.com/tobymao/sqlglot/blob/main/tests/\">test suite</a>. It is also quite <a href=\"#benchmarks\">performant</a>, while being written purely in Python.</p>\n\n<p>You can easily <a href=\"#custom-dialects\">customize</a> the parser, <a href=\"#metadata\">analyze</a> queries, traverse expression trees, and programmatically <a href=\"#build-and-modify-sql\">build</a> SQL.</p>\n\n<p>Syntax <a href=\"#parser-errors\">errors</a> are highlighted and dialect incompatibilities can warn or raise depending on configurations. However, it should be noted that SQL validation is not SQLGlot\u2019s goal, so some syntax errors may go unnoticed.</p>\n\n<p>Contributions are very welcome in SQLGlot; read the <a href=\"https://github.com/tobymao/sqlglot/blob/main/CONTRIBUTING.md\">contribution guide</a> to get started!</p>\n\n<h2 id=\"table-of-contents\">Table of Contents</h2>\n\n<ul>\n<li><a href=\"#install\">Install</a></li>\n<li><a href=\"#get-in-touch\">Get in Touch</a></li>\n<li><a href=\"#examples\">Examples</a>\n<ul>\n<li><a href=\"#formatting-and-transpiling\">Formatting and Transpiling</a></li>\n<li><a href=\"#metadata\">Metadata</a></li>\n<li><a href=\"#parser-errors\">Parser Errors</a></li>\n<li><a href=\"#unsupported-errors\">Unsupported Errors</a></li>\n<li><a href=\"#build-and-modify-sql\">Build and Modify SQL</a></li>\n<li><a href=\"#sql-optimizer\">SQL Optimizer</a></li>\n<li><a href=\"#ast-introspection\">AST Introspection</a></li>\n<li><a href=\"#ast-diff\">AST Diff</a></li>\n<li><a href=\"#custom-dialects\">Custom Dialects</a></li>\n<li><a href=\"#sql-execution\">SQL Execution</a></li>\n</ul></li>\n<li><a href=\"#used-by\">Used By</a></li>\n<li><a href=\"#documentation\">Documentation</a></li>\n<li><a href=\"#run-tests-and-lint\">Run Tests and Lint</a></li>\n<li><a href=\"#benchmarks\">Benchmarks</a></li>\n<li><a href=\"#optional-dependencies\">Optional Dependencies</a></li>\n</ul>\n\n<h2 id=\"install\">Install</h2>\n\n<p>From PyPI:</p>\n\n<pre><code>pip3 install sqlglot\n</code></pre>\n\n<p>Or with a local checkout:</p>\n\n<pre><code>make install\n</code></pre>\n\n<p>Requirements for development (optional):</p>\n\n<pre><code>make install-dev\n</code></pre>\n\n<h2 id=\"get-in-touch\">Get in Touch</h2>\n\n<p>We'd love to hear from you. Join our community <a href=\"https://join.slack.com/t/tobiko-data/shared_invite/zt-1ma66d79v-a4dbf4DUpLAQJ8ptQrJygg\">Slack channel</a>!</p>\n\n<h2 id=\"examples\">Examples</h2>\n\n<h3 id=\"formatting-and-transpiling\">Formatting and Transpiling</h3>\n\n<p>Easily translate from one dialect to another. For example, date/time functions vary from dialects and can be hard to deal with:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">transpile</span><span class=\"p\">(</span><span class=\"s2\">"SELECT EPOCH_MS(1618088028295)"</span><span class=\"p\">,</span> <span class=\"n\">read</span><spa